CTR-Pia  5.4.3
Game Communication Engine
 全て クラス ネームスペース 関数 変数 型定義 列挙型 列挙型の値 ページ
pia_Macros.h
1 /*--------------------------------------------------------------------------------*
2  Copyright (C)Nintendo All rights reserved.
3 
4  These coded instructions, statements, and computer programs contain proprietary
5  information of Nintendo and/or its licensed developers and are protected by
6  national and international copyright laws. They may not be disclosed to third
7  parties or copied or duplicated in any form, in whole or in part, without the
8  prior written consent of Nintendo.
9 
10  The content herein is highly confidential and should be handled accordingly.
11  *--------------------------------------------------------------------------------*/
12 
13 
14 #pragma once
15 
16 #include <nn/pia/pia_Settings.h>
17 
18 
19 /*!
20  @brief 未使用変数に対して発せられるWarningを抑制するためのマクロです。
21 */
22 #define NN_PIA_UNUSED(var) ((void)&var)
23 
24 
25 /*!
26  @brief 未使用変数に対して発せられるWarningを抑制するためのマクロですが、
27  リリースビルド時のみ機能します。
28  例えばアサートでのみチェックしている変数に対してWarningが通知されてしまう
29  煩雑さを解消するために用意しました。
30 */
31 #if NN_PIA_RELEASE
32 #define NN_PIA_UNUSED_IN_RELEASE(var) ((void)&var)
33 #else
34 #define NN_PIA_UNUSED_IN_RELEASE(var)
35 #endif
36 
37 
38 /*!
39  @brief コピーコンストラクタとコピー代入演算子を禁止します。
40  引数にはクラス名を記述します。
41  このマクロを使用する事でアクセス制限が private に変化するので、
42  クラス定義の最後尾に記述するのが良いかもしれません。
43 */
44 #define NN_PIA_DISALLOW_COPY(type) \
45  \
46 private: \
47  type(const type&); \
48  type& operator=(const type&)
49 
50 
51 // warning抑制マクロ
52 #if NN_PIA_NINTENDOSDK_NX || NN_PIA_A || NN_PIA_B
53 #define NN_PIA_PRAGMA_PUSH_WARNINGS _Pragma("clang diagnostic push")
54 #define NN_PIA_PRAGMA_POP_WARNINGS _Pragma("clang diagnostic pop")
55 #define NN_PIA_DISABLE_WARNING_CLANG_INVALID_OFFSETOF _Pragma("clang diagnostic ignored \"-Winvalid-offsetof\"")
56 #define NN_PIA_DISABLE_WARNING_CLANG_FORMAT_SECURITY _Pragma("clang diagnostic ignored \"-Wformat-security\"")
57 #define NN_PIA_DISABLE_WARNING_CLANG_UNUSED_PRIVATE_FIELD _Pragma("clang diagnostic ignored \"-Wunused-private-field\"")
58 #define NN_PIA_DISABLE_WARNING_CLANG_UNUSED_VARIABLE _Pragma("clang diagnostic ignored \"-Wunused-variable\"")
59 #define NN_PIA_DISABLE_WARNING_CLANG_UNUSED_FUNCTION _Pragma("clang diagnostic ignored \"-Wunused-function\"")
60 #define NN_PIA_DISABLE_WARNING_CLANG_UNINITIALIZED _Pragma("clang diagnostic ignored \"-Wuninitialized\"")
61 #define NN_PIA_DISABLE_WARNING_WIN_4005
62 #define NN_PIA_DISABLE_WARNING_WIN_4307
63 #define NN_PIA_DISABLE_WARNING_WIN_4355
64 #define NN_PIA_DISABLE_WARNING_WIN_4996
65 #elif NN_PIA_NINTENDOSDK_WIN || NN_PIA_WIN
66 #define NN_PIA_PRAGMA_PUSH_WARNINGS __pragma(warning(push))
67 #define NN_PIA_PRAGMA_POP_WARNINGS __pragma(warning(pop))
68 #define NN_PIA_DISABLE_WARNING_CLANG_INVALID_OFFSETOF
69 #define NN_PIA_DISABLE_WARNING_CLANG_FORMAT_SECURITY
70 #define NN_PIA_DISABLE_WARNING_CLANG_UNUSED_PRIVATE_FIELD
71 #define NN_PIA_DISABLE_WARNING_CLANG_UNUSED_VARIABLE
72 #define NN_PIA_DISABLE_WARNING_CLANG_UNUSED_FUNCTION
73 #define NN_PIA_DISABLE_WARNING_CLANG_UNINITIALIZED
74 #define NN_PIA_DISABLE_WARNING_WIN_4005 __pragma(warning(disable : 4005))
75 #define NN_PIA_DISABLE_WARNING_WIN_4307 __pragma(warning(disable : 4307))
76 #define NN_PIA_DISABLE_WARNING_WIN_4355 __pragma(warning(disable : 4355))
77 #define NN_PIA_DISABLE_WARNING_WIN_4996 __pragma(warning(disable : 4996))
78 #else
79 #define NN_PIA_PRAGMA_PUSH_WARNINGS
80 #define NN_PIA_PRAGMA_POP_WARNINGS
81 #define NN_PIA_DISABLE_WARNING_CLANG_INVALID_OFFSETOF
82 #define NN_PIA_DISABLE_WARNING_CLANG_FORMAT_SECURITY
83 #define NN_PIA_DISABLE_WARNING_CLANG_UNUSED_PRIVATE_FIELD
84 #define NN_PIA_DISABLE_WARNING_CLANG_UNUSED_VARIABLE
85 #define NN_PIA_DISABLE_WARNING_CLANG_UNUSED_FUNCTION
86 #define NN_PIA_DISABLE_WARNING_CLANG_UNINITIALIZED
87 #define NN_PIA_DISABLE_WARNING_WIN_4005
88 #define NN_PIA_DISABLE_WARNING_WIN_4307
89 #define NN_PIA_DISABLE_WARNING_WIN_4355
90 #define NN_PIA_DISABLE_WARNING_WIN_4996
91 #endif