From 1ad0f7b1499f14b29370bbdab7db65d539bf43e3 Mon Sep 17 00:00:00 2001 From: Alex Bates Date: Fri, 16 Sep 2022 19:27:35 +0100 Subject: [PATCH] Fix 'badly punctuated parameter list in define' issues (#777) * remove defines of old SCRIPT macro * get rid of uses of unnamed ... --- .vscode/c_cpp_properties.json | 1 - .vscode/settings.json | 1 - Doxyfile | 2 +- format.sh | 2 +- include/macros.h | 5 ----- include/npc.h | 4 ++-- src/evt/msg_api.h | 16 ++++++++-------- 7 files changed, 12 insertions(+), 19 deletions(-) diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index e0ea510295..9c5b0e4c9d 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -20,7 +20,6 @@ "F3DEX_GBI_2", "_LANGUAGE_C", "_MIPS_SZLONG=32", - "SCRIPT(...)={}", "VERSION=us", "VERSION_US" ], diff --git a/.vscode/settings.json b/.vscode/settings.json index d694cb1eb9..39db3d364d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -9,7 +9,6 @@ "-Iver/current/build/include", "-Isrc", "-D_LANGUAGE_C", - "-DSCRIPT(...)={}", "-Wall" ], "clang-tidy.blacklist": [ diff --git a/Doxyfile b/Doxyfile index 48bedc8645..343634104a 100644 --- a/Doxyfile +++ b/Doxyfile @@ -103,7 +103,7 @@ GENERATE_LATEX = NO ENABLE_PREPROCESSING = YES MACRO_EXPANSION = YES EXPAND_ONLY_PREDEF = YES -PREDEFINED = DOXYGEN NON_MATCHING SCRIPT(...)={} __attribute__((x))= +PREDEFINED = DOXYGEN NON_MATCHING __attribute__((x))= EXPAND_AS_DEFINED = INCLUDE_ASM UNK_TYPE UNK_PTR UNK_RET UNK_FUN_ARG UNK_FUN_PTR UNK_ARGS M SKIP_FUNCTION_MACROS = YES diff --git a/format.sh b/format.sh index ba64effa51..18385b414a 100755 --- a/format.sh +++ b/format.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -COMPILER_OPTS="-std=gnu89 -Iinclude -Isrc -D_LANGUAGE_C -DSCRIPT(...)={}" +COMPILER_OPTS="-std=gnu89 -Iinclude -Isrc -D_LANGUAGE_C" shopt -s globstar diff --git a/include/macros.h b/include/macros.h index 67e66487ad..ef89172a42 100644 --- a/include/macros.h +++ b/include/macros.h @@ -146,9 +146,4 @@ #define VAR_PROJECTILE_HITBOX_STATE varTable[0] #define AI_PROJECTILE_AMMO_COUNT varTable[3] -#ifdef PERMUTER -#undef SCRIPT -#define SCRIPT(...) {} -#endif - #endif diff --git a/include/npc.h b/include/npc.h index a04e3954fb..e0d24221b4 100644 --- a/include/npc.h +++ b/include/npc.h @@ -5,8 +5,8 @@ #include "enums.h" #include "script_api/map.h" -#define GET_MACRO(_1,_2,_3,NAME,...) NAME -#define NPC_GROUP(...) GET_MACRO(__VA_ARGS__, NPC_GROUP_3, NPC_GROUP_2, NPC_GROUP_1)(__VA_ARGS__) +#define GET_MACRO(_1,_2,_3,NAME,ARGS...) NAME +#define NPC_GROUP(ARGS...) GET_MACRO(ARGS, NPC_GROUP_3, NPC_GROUP_2, NPC_GROUP_1)(ARGS) // battle and stage are optional in overloaded NPC_GROUP macros #define NPC_GROUP_1(npcs) { sizeof(npcs) / sizeof(StaticNpc), (StaticNpc*) &npcs, 0, 0 } diff --git a/src/evt/msg_api.h b/src/evt/msg_api.h index 5541fcc5fe..4fb53a0e68 100644 --- a/src/evt/msg_api.h +++ b/src/evt/msg_api.h @@ -3,20 +3,20 @@ #include "script_api/macros.h" -#define SpeakToPlayer(...) \ - _EVT_CMD(EVT_OP_CALL, evt_SpeakToPlayer, ##__VA_ARGS__), +#define SpeakToPlayer(ARGS...) \ + _EVT_CMD(EVT_OP_CALL, evt_SpeakToPlayer, ##ARGS), ApiStatus evt_SpeakToPlayer(Evt* script, s32 isInitialCall); -#define EndSpeech(...) \ - _EVT_CMD(EVT_OP_CALL, evt_EndSpeech, ##__VA_ARGS__), +#define EndSpeech(ARGS...) \ + _EVT_CMD(EVT_OP_CALL, evt_EndSpeech, ##ARGS), ApiStatus evt_EndSpeech(Evt* script, s32 isInitialCall); -#define ContinueSpeech(...) \ - _EVT_CMD(EVT_OP_CALL, evt_ContinueSpeech, ##__VA_ARGS__), +#define ContinueSpeech(ARGS...) \ + _EVT_CMD(EVT_OP_CALL, evt_ContinueSpeech, ##ARGS), ApiStatus evt_ContinueSpeech(Evt* script, s32 isInitialCall); -#define SpeakToNpc(...) \ - _EVT_CMD(EVT_OP_CALL, evt_SpeakToNpc, ##__VA_ARGS__), +#define SpeakToNpc(ARGS...) \ + _EVT_CMD(EVT_OP_CALL, evt_SpeakToNpc, ##ARGS), ApiStatus evt_SpeakToNpc(Evt* script, s32 isInitialCall); #endif