Skip to content

Commit 0d5165b

Browse files
authored
Merge pull request ddnet#10497 from KebsCS/pr-cpp20-refactors3
Remove redundant MAYBE_UNUSED macro, fix __cplusplus on MSVC
2 parents fc09374 + 6e5a3b9 commit 0d5165b

File tree

5 files changed

+90
-97
lines changed

5 files changed

+90
-97
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3529,6 +3529,7 @@ set(TARGETS ${TARGETS_OWN} ${TARGETS_DEP})
35293529
foreach(target ${TARGETS})
35303530
if(MSVC)
35313531
set_property(TARGET ${target} PROPERTY MSVC_RUNTIME_LIBRARY MultiThreaded$<${DBG}:Debug>) # Use static CRT
3532+
target_compile_options(${target} PRIVATE /Zc:__cplusplus) # Fixes the __cplusplus macro
35323533
target_compile_options(${target} PRIVATE /MP) # Use multiple cores
35333534
target_compile_options(${target} PRIVATE /EHsc) # Only catch C++ exceptions with catch.
35343535
target_compile_options(${target} PRIVATE /GS) # Protect the stack pointer.

src/base/system.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,6 @@
4343
#include <sys/socket.h>
4444
#endif
4545

46-
#if __cplusplus >= 201703L
47-
#define MAYBE_UNUSED [[maybe_unused]]
48-
#elif defined(__GNUC__)
49-
#define MAYBE_UNUSED __attribute__((unused))
50-
#else
51-
#define MAYBE_UNUSED
52-
#endif
53-
5446
#ifdef __GNUC__
5547
#define GNUC_ATTRIBUTE(x) __attribute__(x)
5648
#else

src/engine/textrender.h

Lines changed: 87 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -65,93 +65,93 @@ enum class EFontPreset
6565

6666
namespace FontIcons {
6767
// Each font icon is named according to its official name in Font Awesome
68-
MAYBE_UNUSED static const char *FONT_ICON_PLUS = "+";
69-
MAYBE_UNUSED static const char *FONT_ICON_MINUS = "-";
70-
MAYBE_UNUSED static const char *FONT_ICON_LOCK = "\xEF\x80\xA3";
71-
MAYBE_UNUSED static const char *FONT_ICON_MAGNIFYING_GLASS = "\xEF\x80\x82";
72-
MAYBE_UNUSED static const char *FONT_ICON_HEART = "\xEF\x80\x84";
73-
MAYBE_UNUSED static const char *FONT_ICON_STAR = "\xEF\x80\x85";
74-
MAYBE_UNUSED static const char *FONT_ICON_XMARK = "\xEF\x80\x8D";
75-
MAYBE_UNUSED static const char *FONT_ICON_CIRCLE = "\xEF\x84\x91";
76-
MAYBE_UNUSED static const char *FONT_ICON_ARROW_ROTATE_LEFT = "\xEF\x83\xA2";
77-
MAYBE_UNUSED static const char *FONT_ICON_ARROW_ROTATE_RIGHT = "\xEF\x80\x9E";
78-
MAYBE_UNUSED static const char *FONT_ICON_FLAG_CHECKERED = "\xEF\x84\x9E";
79-
MAYBE_UNUSED static const char *FONT_ICON_BAN = "\xEF\x81\x9E";
80-
MAYBE_UNUSED static const char *FONT_ICON_CIRCLE_CHEVRON_DOWN = "\xEF\x84\xBA";
81-
MAYBE_UNUSED static const char *FONT_ICON_SQUARE_MINUS = "\xEF\x85\x86";
82-
MAYBE_UNUSED static const char *FONT_ICON_SQUARE_PLUS = "\xEF\x83\xBE";
83-
MAYBE_UNUSED static const char *FONT_ICON_SORT_UP = "\xEF\x83\x9E";
84-
MAYBE_UNUSED static const char *FONT_ICON_SORT_DOWN = "\xEF\x83\x9D";
85-
MAYBE_UNUSED static const char *FONT_ICON_TRIANGLE_EXCLAMATION = "\xEF\x81\xB1";
86-
87-
MAYBE_UNUSED static const char *FONT_ICON_HOUSE = "\xEF\x80\x95";
88-
MAYBE_UNUSED static const char *FONT_ICON_NEWSPAPER = "\xEF\x87\xAA";
89-
MAYBE_UNUSED static const char *FONT_ICON_POWER_OFF = "\xEF\x80\x91";
90-
MAYBE_UNUSED static const char *FONT_ICON_GEAR = "\xEF\x80\x93";
91-
MAYBE_UNUSED static const char *FONT_ICON_PEN_TO_SQUARE = "\xEF\x81\x84";
92-
MAYBE_UNUSED static const char *FONT_ICON_CLAPPERBOARD = "\xEE\x84\xB1";
93-
MAYBE_UNUSED static const char *FONT_ICON_EARTH_AMERICAS = "\xEF\x95\xBD";
94-
MAYBE_UNUSED static const char *FONT_ICON_NETWORK_WIRED = "\xEF\x9B\xBF";
95-
MAYBE_UNUSED static const char *FONT_ICON_LIST_UL = "\xEF\x83\x8A";
96-
MAYBE_UNUSED static const char *FONT_ICON_INFO = "\xEF\x84\xA9";
97-
MAYBE_UNUSED static const char *FONT_ICON_TERMINAL = "\xEF\x84\xA0";
98-
99-
MAYBE_UNUSED static const char *FONT_ICON_SLASH = "\xEF\x9C\x95";
100-
MAYBE_UNUSED static const char *FONT_ICON_PLAY = "\xEF\x81\x8B";
101-
MAYBE_UNUSED static const char *FONT_ICON_PAUSE = "\xEF\x81\x8C";
102-
MAYBE_UNUSED static const char *FONT_ICON_STOP = "\xEF\x81\x8D";
103-
MAYBE_UNUSED static const char *FONT_ICON_CHEVRON_LEFT = "\xEF\x81\x93";
104-
MAYBE_UNUSED static const char *FONT_ICON_CHEVRON_RIGHT = "\xEF\x81\x94";
105-
MAYBE_UNUSED static const char *FONT_ICON_CHEVRON_UP = "\xEF\x81\xB7";
106-
MAYBE_UNUSED static const char *FONT_ICON_CHEVRON_DOWN = "\xEF\x81\xB8";
107-
MAYBE_UNUSED static const char *FONT_ICON_BACKWARD = "\xEF\x81\x8A";
108-
MAYBE_UNUSED static const char *FONT_ICON_FORWARD = "\xEF\x81\x8E";
109-
MAYBE_UNUSED static const char *FONT_ICON_RIGHT_FROM_BRACKET = "\xEF\x8B\xB5";
110-
MAYBE_UNUSED static const char *FONT_ICON_RIGHT_TO_BRACKET = "\xEF\x8B\xB6";
111-
MAYBE_UNUSED static const char *FONT_ICON_ARROW_UP_RIGHT_FROM_SQUARE = "\xEF\x82\x8E";
112-
MAYBE_UNUSED static const char *FONT_ICON_BACKWARD_STEP = "\xEF\x81\x88";
113-
MAYBE_UNUSED static const char *FONT_ICON_FORWARD_STEP = "\xEF\x81\x91";
114-
MAYBE_UNUSED static const char *FONT_ICON_BACKWARD_FAST = "\xEF\x81\x89";
115-
MAYBE_UNUSED static const char *FONT_ICON_FORWARD_FAST = "\xEF\x81\x90";
116-
MAYBE_UNUSED static const char *FONT_ICON_KEYBOARD = "\xE2\x8C\xA8";
117-
MAYBE_UNUSED static const char *FONT_ICON_ELLIPSIS = "\xEF\x85\x81";
118-
119-
MAYBE_UNUSED static const char *FONT_ICON_FOLDER = "\xEF\x81\xBB";
120-
MAYBE_UNUSED static const char *FONT_ICON_FOLDER_OPEN = "\xEF\x81\xBC";
121-
MAYBE_UNUSED static const char *FONT_ICON_FOLDER_TREE = "\xEF\xA0\x82";
122-
MAYBE_UNUSED static const char *FONT_ICON_FILM = "\xEF\x80\x88";
123-
MAYBE_UNUSED static const char *FONT_ICON_VIDEO = "\xEF\x80\xBD";
124-
MAYBE_UNUSED static const char *FONT_ICON_MAP = "\xEF\x89\xB9";
125-
MAYBE_UNUSED static const char *FONT_ICON_IMAGE = "\xEF\x80\xBE";
126-
MAYBE_UNUSED static const char *FONT_ICON_MUSIC = "\xEF\x80\x81";
127-
MAYBE_UNUSED static const char *FONT_ICON_FILE = "\xEF\x85\x9B";
128-
129-
MAYBE_UNUSED static const char *FONT_ICON_PENCIL = "\xEF\x8C\x83";
130-
MAYBE_UNUSED static const char *FONT_ICON_TRASH = "\xEF\x87\xB8";
131-
132-
MAYBE_UNUSED static const char *FONT_ICON_ARROWS_LEFT_RIGHT = "\xEF\x8C\xB7";
133-
MAYBE_UNUSED static const char *FONT_ICON_ARROWS_UP_DOWN = "\xEF\x81\xBD";
134-
MAYBE_UNUSED static const char *FONT_ICON_CIRCLE_PLAY = "\xEF\x85\x84";
135-
MAYBE_UNUSED static const char *FONT_ICON_BORDER_ALL = "\xEF\xA1\x8C";
136-
MAYBE_UNUSED static const char *FONT_ICON_EYE = "\xEF\x81\xAE";
137-
MAYBE_UNUSED static const char *FONT_ICON_EYE_SLASH = "\xEF\x81\xB0";
138-
MAYBE_UNUSED static const char *FONT_ICON_EYE_DROPPER = "\xEF\x87\xBB";
139-
140-
MAYBE_UNUSED static const char *FONT_ICON_DICE_ONE = "\xEF\x94\xA5";
141-
MAYBE_UNUSED static const char *FONT_ICON_DICE_TWO = "\xEF\x94\xA8";
142-
MAYBE_UNUSED static const char *FONT_ICON_DICE_THREE = "\xEF\x94\xA7";
143-
MAYBE_UNUSED static const char *FONT_ICON_DICE_FOUR = "\xEF\x94\xA4";
144-
MAYBE_UNUSED static const char *FONT_ICON_DICE_FIVE = "\xEF\x94\xA3";
145-
MAYBE_UNUSED static const char *FONT_ICON_DICE_SIX = "\xEF\x94\xA6";
146-
147-
MAYBE_UNUSED static const char *FONT_ICON_LAYER_GROUP = "\xEF\x97\xBD";
148-
MAYBE_UNUSED static const char *FONT_ICON_UNDO = "\xEF\x8B\xAA";
149-
MAYBE_UNUSED static const char *FONT_ICON_REDO = "\xEF\x8B\xB9";
150-
151-
MAYBE_UNUSED static const char *FONT_ICON_ARROWS_ROTATE = "\xEF\x80\xA1";
152-
MAYBE_UNUSED static const char *FONT_ICON_QUESTION = "?";
153-
154-
MAYBE_UNUSED static const char *FONT_ICON_CAMERA = "\xEF\x80\xB0";
68+
[[maybe_unused]] static const char *FONT_ICON_PLUS = "+";
69+
[[maybe_unused]] static const char *FONT_ICON_MINUS = "-";
70+
[[maybe_unused]] static const char *FONT_ICON_LOCK = "\xEF\x80\xA3";
71+
[[maybe_unused]] static const char *FONT_ICON_MAGNIFYING_GLASS = "\xEF\x80\x82";
72+
[[maybe_unused]] static const char *FONT_ICON_HEART = "\xEF\x80\x84";
73+
[[maybe_unused]] static const char *FONT_ICON_STAR = "\xEF\x80\x85";
74+
[[maybe_unused]] static const char *FONT_ICON_XMARK = "\xEF\x80\x8D";
75+
[[maybe_unused]] static const char *FONT_ICON_CIRCLE = "\xEF\x84\x91";
76+
[[maybe_unused]] static const char *FONT_ICON_ARROW_ROTATE_LEFT = "\xEF\x83\xA2";
77+
[[maybe_unused]] static const char *FONT_ICON_ARROW_ROTATE_RIGHT = "\xEF\x80\x9E";
78+
[[maybe_unused]] static const char *FONT_ICON_FLAG_CHECKERED = "\xEF\x84\x9E";
79+
[[maybe_unused]] static const char *FONT_ICON_BAN = "\xEF\x81\x9E";
80+
[[maybe_unused]] static const char *FONT_ICON_CIRCLE_CHEVRON_DOWN = "\xEF\x84\xBA";
81+
[[maybe_unused]] static const char *FONT_ICON_SQUARE_MINUS = "\xEF\x85\x86";
82+
[[maybe_unused]] static const char *FONT_ICON_SQUARE_PLUS = "\xEF\x83\xBE";
83+
[[maybe_unused]] static const char *FONT_ICON_SORT_UP = "\xEF\x83\x9E";
84+
[[maybe_unused]] static const char *FONT_ICON_SORT_DOWN = "\xEF\x83\x9D";
85+
[[maybe_unused]] static const char *FONT_ICON_TRIANGLE_EXCLAMATION = "\xEF\x81\xB1";
86+
87+
[[maybe_unused]] static const char *FONT_ICON_HOUSE = "\xEF\x80\x95";
88+
[[maybe_unused]] static const char *FONT_ICON_NEWSPAPER = "\xEF\x87\xAA";
89+
[[maybe_unused]] static const char *FONT_ICON_POWER_OFF = "\xEF\x80\x91";
90+
[[maybe_unused]] static const char *FONT_ICON_GEAR = "\xEF\x80\x93";
91+
[[maybe_unused]] static const char *FONT_ICON_PEN_TO_SQUARE = "\xEF\x81\x84";
92+
[[maybe_unused]] static const char *FONT_ICON_CLAPPERBOARD = "\xEE\x84\xB1";
93+
[[maybe_unused]] static const char *FONT_ICON_EARTH_AMERICAS = "\xEF\x95\xBD";
94+
[[maybe_unused]] static const char *FONT_ICON_NETWORK_WIRED = "\xEF\x9B\xBF";
95+
[[maybe_unused]] static const char *FONT_ICON_LIST_UL = "\xEF\x83\x8A";
96+
[[maybe_unused]] static const char *FONT_ICON_INFO = "\xEF\x84\xA9";
97+
[[maybe_unused]] static const char *FONT_ICON_TERMINAL = "\xEF\x84\xA0";
98+
99+
[[maybe_unused]] static const char *FONT_ICON_SLASH = "\xEF\x9C\x95";
100+
[[maybe_unused]] static const char *FONT_ICON_PLAY = "\xEF\x81\x8B";
101+
[[maybe_unused]] static const char *FONT_ICON_PAUSE = "\xEF\x81\x8C";
102+
[[maybe_unused]] static const char *FONT_ICON_STOP = "\xEF\x81\x8D";
103+
[[maybe_unused]] static const char *FONT_ICON_CHEVRON_LEFT = "\xEF\x81\x93";
104+
[[maybe_unused]] static const char *FONT_ICON_CHEVRON_RIGHT = "\xEF\x81\x94";
105+
[[maybe_unused]] static const char *FONT_ICON_CHEVRON_UP = "\xEF\x81\xB7";
106+
[[maybe_unused]] static const char *FONT_ICON_CHEVRON_DOWN = "\xEF\x81\xB8";
107+
[[maybe_unused]] static const char *FONT_ICON_BACKWARD = "\xEF\x81\x8A";
108+
[[maybe_unused]] static const char *FONT_ICON_FORWARD = "\xEF\x81\x8E";
109+
[[maybe_unused]] static const char *FONT_ICON_RIGHT_FROM_BRACKET = "\xEF\x8B\xB5";
110+
[[maybe_unused]] static const char *FONT_ICON_RIGHT_TO_BRACKET = "\xEF\x8B\xB6";
111+
[[maybe_unused]] static const char *FONT_ICON_ARROW_UP_RIGHT_FROM_SQUARE = "\xEF\x82\x8E";
112+
[[maybe_unused]] static const char *FONT_ICON_BACKWARD_STEP = "\xEF\x81\x88";
113+
[[maybe_unused]] static const char *FONT_ICON_FORWARD_STEP = "\xEF\x81\x91";
114+
[[maybe_unused]] static const char *FONT_ICON_BACKWARD_FAST = "\xEF\x81\x89";
115+
[[maybe_unused]] static const char *FONT_ICON_FORWARD_FAST = "\xEF\x81\x90";
116+
[[maybe_unused]] static const char *FONT_ICON_KEYBOARD = "\xE2\x8C\xA8";
117+
[[maybe_unused]] static const char *FONT_ICON_ELLIPSIS = "\xEF\x85\x81";
118+
119+
[[maybe_unused]] static const char *FONT_ICON_FOLDER = "\xEF\x81\xBB";
120+
[[maybe_unused]] static const char *FONT_ICON_FOLDER_OPEN = "\xEF\x81\xBC";
121+
[[maybe_unused]] static const char *FONT_ICON_FOLDER_TREE = "\xEF\xA0\x82";
122+
[[maybe_unused]] static const char *FONT_ICON_FILM = "\xEF\x80\x88";
123+
[[maybe_unused]] static const char *FONT_ICON_VIDEO = "\xEF\x80\xBD";
124+
[[maybe_unused]] static const char *FONT_ICON_MAP = "\xEF\x89\xB9";
125+
[[maybe_unused]] static const char *FONT_ICON_IMAGE = "\xEF\x80\xBE";
126+
[[maybe_unused]] static const char *FONT_ICON_MUSIC = "\xEF\x80\x81";
127+
[[maybe_unused]] static const char *FONT_ICON_FILE = "\xEF\x85\x9B";
128+
129+
[[maybe_unused]] static const char *FONT_ICON_PENCIL = "\xEF\x8C\x83";
130+
[[maybe_unused]] static const char *FONT_ICON_TRASH = "\xEF\x87\xB8";
131+
132+
[[maybe_unused]] static const char *FONT_ICON_ARROWS_LEFT_RIGHT = "\xEF\x8C\xB7";
133+
[[maybe_unused]] static const char *FONT_ICON_ARROWS_UP_DOWN = "\xEF\x81\xBD";
134+
[[maybe_unused]] static const char *FONT_ICON_CIRCLE_PLAY = "\xEF\x85\x84";
135+
[[maybe_unused]] static const char *FONT_ICON_BORDER_ALL = "\xEF\xA1\x8C";
136+
[[maybe_unused]] static const char *FONT_ICON_EYE = "\xEF\x81\xAE";
137+
[[maybe_unused]] static const char *FONT_ICON_EYE_SLASH = "\xEF\x81\xB0";
138+
[[maybe_unused]] static const char *FONT_ICON_EYE_DROPPER = "\xEF\x87\xBB";
139+
140+
[[maybe_unused]] static const char *FONT_ICON_DICE_ONE = "\xEF\x94\xA5";
141+
[[maybe_unused]] static const char *FONT_ICON_DICE_TWO = "\xEF\x94\xA8";
142+
[[maybe_unused]] static const char *FONT_ICON_DICE_THREE = "\xEF\x94\xA7";
143+
[[maybe_unused]] static const char *FONT_ICON_DICE_FOUR = "\xEF\x94\xA4";
144+
[[maybe_unused]] static const char *FONT_ICON_DICE_FIVE = "\xEF\x94\xA3";
145+
[[maybe_unused]] static const char *FONT_ICON_DICE_SIX = "\xEF\x94\xA6";
146+
147+
[[maybe_unused]] static const char *FONT_ICON_LAYER_GROUP = "\xEF\x97\xBD";
148+
[[maybe_unused]] static const char *FONT_ICON_UNDO = "\xEF\x8B\xAA";
149+
[[maybe_unused]] static const char *FONT_ICON_REDO = "\xEF\x8B\xB9";
150+
151+
[[maybe_unused]] static const char *FONT_ICON_ARROWS_ROTATE = "\xEF\x80\xA1";
152+
[[maybe_unused]] static const char *FONT_ICON_QUESTION = "?";
153+
154+
[[maybe_unused]] static const char *FONT_ICON_CAMERA = "\xEF\x80\xB0";
155155
} // end namespace FontIcons
156156

157157
enum ETextCursorSelectionMode

src/game/alloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public: \
5050
#define MACRO_ALLOC_POOL_ID_IMPL(POOLTYPE, PoolSize) \
5151
static char gs_PoolData##POOLTYPE[PoolSize][MACRO_ALLOC_GET_SIZE(POOLTYPE)] = {{0}}; \
5252
static int gs_PoolUsed##POOLTYPE[PoolSize] = {0}; \
53-
MAYBE_UNUSED static int gs_PoolDummy##POOLTYPE = (ASAN_POISON_MEMORY_REGION(gs_PoolData##POOLTYPE, sizeof(gs_PoolData##POOLTYPE)), 0); \
53+
[[maybe_unused]] static int gs_PoolDummy##POOLTYPE = (ASAN_POISON_MEMORY_REGION(gs_PoolData##POOLTYPE, sizeof(gs_PoolData##POOLTYPE)), 0); \
5454
void *POOLTYPE::operator new(size_t Size, int Id) \
5555
{ \
5656
dbg_assert(sizeof(POOLTYPE) >= Size, "size error"); \

src/game/editor/editor_ui.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct SEditBoxDropdownContext
1616
};
1717

1818
namespace EditorFontSizes {
19-
MAYBE_UNUSED static constexpr float MENU = 10.0f;
19+
[[maybe_unused]] static constexpr float MENU = 10.0f;
2020
}
2121

2222
#endif

0 commit comments

Comments
 (0)