From 4a1db9c3ea04f33adb2f0898f9eed3a1e986c473 Mon Sep 17 00:00:00 2001 From: tradke Date: Sun, 9 Dec 2001 22:04:13 +0000 Subject: Define USE_ARGUMENTS macro which expands to something which use the arguments of overloaded functions. This gets rid of nasty compiler warnings about unused function arguments for dummy overloadables. git-svn-id: http://svn.cactuscode.org/flesh/trunk@2488 17b73243-c579-4c4c-a9d2-2d5706c11dac --- src/include/CommOverloadables.h | 20 ++++++++++++++++++++ src/include/IOOverloadables.h | 10 +++++++++- src/include/MainOverloadables.h | 30 ++++++++++++++++++++---------- src/include/OverloadMacros.h | 2 ++ 4 files changed, 51 insertions(+), 11 deletions(-) diff --git a/src/include/CommOverloadables.h b/src/include/CommOverloadables.h index 96d9741a..b59a05b7 100644 --- a/src/include/CommOverloadables.h +++ b/src/include/CommOverloadables.h @@ -32,12 +32,17 @@ #undef ARGUMENTS #endif +#ifdef USE_ARGUMENTS +#undef USE_ARGUMENTS +#endif + #ifdef RETURN_TYPE #undef RETURN_TYPE #endif #define RETURN_TYPE int #define ARGUMENTS cGH *GH, const char *group +#define USE_ARGUMENTS GH = GH; group = group; OVERLOADABLE(SyncGroup) OVERLOADABLE(EnableGroupStorage) @@ -48,16 +53,22 @@ OVERLOADABLE(DisableGroupComm) #undef ARGUMENTS #define ARGUMENTS const cGH *GH +#undef USE_ARGUMENTS +#define USE_ARGUMENTS GH = GH; OVERLOADABLE(Barrier) OVERLOADABLE(MyProc) OVERLOADABLE(nProcs) #undef ARGUMENTS #define ARGUMENTS cGH *GH +#undef USE_ARGUMENTS +#define USE_ARGUMENTS GH = GH; OVERLOADABLE(ParallelInit) #undef ARGUMENTS #define ARGUMENTS cGH *GH, int retval +#undef USE_ARGUMENTS +#define USE_ARGUMENTS GH = GH; retval = retval; #undef RETURN_TYPE #define RETURN_TYPE int OVERLOADABLE(Exit) @@ -65,29 +76,38 @@ OVERLOADABLE(Abort) #undef ARGUMENTS #define ARGUMENTS tFleshConfig *config, int convergence_level +#undef USE_ARGUMENTS +#define USE_ARGUMENTS config = config; convergence_level = convergence_level; #undef RETURN_TYPE #define RETURN_TYPE cGH * OVERLOADABLE(SetupGH) #undef ARGUMENTS #define ARGUMENTS const cGH *GH, int dir, int group, const char *groupname +#undef USE_ARGUMENTS +#define USE_ARGUMENTS GH = GH; dir = dir; group = group; groupname = groupname; #undef RETURN_TYPE #define RETURN_TYPE const int * OVERLOADABLE(ArrayGroupSizeB) #undef ARGUMENTS #define ARGUMENTS const cGH *GH, int group, const char *groupname +#undef USE_ARGUMENTS +#define USE_ARGUMENTS GH = GH; group = group; groupname = groupname; #undef RETURN_TYPE #define RETURN_TYPE int OVERLOADABLE(QueryGroupStorageB) #undef ARGUMENTS #define ARGUMENTS const cGH *GH, int group, cGroupDynamicData *data +#undef USE_ARGUMENTS +#define USE_ARGUMENTS GH = GH; group = group; data = data; #undef RETURN_TYPE #define RETURN_TYPE int OVERLOADABLE(GroupDynamicData) #undef ARGUMENTS +#undef USE_ARGUMENTS #undef RETURN_TYPE #undef OVERLOADABLE_CALL diff --git a/src/include/IOOverloadables.h b/src/include/IOOverloadables.h index cbdbcfea..2b0a50de 100644 --- a/src/include/IOOverloadables.h +++ b/src/include/IOOverloadables.h @@ -29,12 +29,17 @@ #undef ARGUMENTS #endif +#ifdef USE_ARGUMENTS +#undef USE_ARGUMENTS +#endif + #ifdef RETURN_TYPE #undef RETURN_TYPE #endif -#define RETURN_TYPE int #define ARGUMENTS const cGH *GH +#define USE_ARGUMENTS GH = GH; +#define RETURN_TYPE int OVERLOADABLE(OutputGH) #undef ARGUMENTS @@ -42,9 +47,12 @@ OVERLOADABLE(OutputGH) const char *var, \ const char *method, \ const char *alias +#undef USE_ARGUMENTS +#define USE_ARGUMENTS GH = GH; var = var; method = method; alias = alias; OVERLOADABLE(OutputVarAsByMethod) #undef ARGUMENTS +#undef USE_ARGUMENTS #undef RETURN_TYPE #undef OVERLOADABLE_CALL diff --git a/src/include/MainOverloadables.h b/src/include/MainOverloadables.h index 34ae5023..f112ece0 100644 --- a/src/include/MainOverloadables.h +++ b/src/include/MainOverloadables.h @@ -2,11 +2,11 @@ @header MainOverloadables.h @date Thu Feb 4 08:58:52 1999 @author Tom Goodale - @desc - The overloadable functions for the main layer. - See OverloadMacros.h to see how to use these. - @enddesc - @version $Header$ + @desc + The overloadable functions for the main layer. + See OverloadMacros.h to see how to use these. + @enddesc + @version $Header$ @@*/ @@ -30,32 +30,42 @@ #undef ARGUMENTS #endif +#ifdef USE_ARGUMENTS +#undef USE_ARGUMENTS +#endif + #ifdef RETURN_TYPE #undef RETURN_TYPE #endif -#define RETURN_TYPE int #define ARGUMENTS tFleshConfig *config +#define USE_ARGUMENTS config = config +#define RETURN_TYPE int OVERLOADABLE(Initialise) OVERLOADABLE(Evolve) OVERLOADABLE(Shutdown) -#undef RETURN_TYPE -#define RETURN_TYPE int #undef ARGUMENTS #define ARGUMENTS void +#undef USE_ARGUMENTS +#define USE_ARGUMENTS +#undef RETURN_TYPE +#define RETURN_TYPE int OVERLOADABLE(MainLoopIndex) -#undef RETURN_TYPE -#define RETURN_TYPE int #undef ARGUMENTS #define ARGUMENTS int main_loop_index +#undef USE_ARGUMENTS +#define USE_ARGUMENTS main_loop_index = main_loop_index; +#undef RETURN_TYPE +#define RETURN_TYPE int OVERLOADABLE(SetMainLoopIndex) #undef ARGUMENTS +#undef USE_ARGUMENTS #undef RETURN_TYPE #undef OVERLOADABLE_CALL diff --git a/src/include/OverloadMacros.h b/src/include/OverloadMacros.h index bc672ee5..973c94c3 100644 --- a/src/include/OverloadMacros.h +++ b/src/include/OverloadMacros.h @@ -86,6 +86,8 @@ extern RETURN_TYPE (*prefix##name)(ARGUMENTS); #define __OVERLOADABLE_DUMMY(prefix, dummy_prefix, name) \ RETURN_TYPE dummy_prefix##name(ARGUMENTS) \ { \ + /* prevent compiler warning about unused parameters */ \ + USE_ARGUMENTS \ fprintf(stderr, "Dummy %s%s called.\n", #dummy_prefix,#name); \ return 0; \ } -- cgit v1.2.3