From c2b6f9902ff7044e8648dbec448f1fbafad46b70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Gr=C3=A4f?= <aggraef@gmail.com> Date: Fri, 16 Feb 2018 11:29:32 +0100 Subject: [PATCH] silence some clang warnings (macOS) --- Makefile | 6 +++++- pdlua.c | 25 ++++++++++++++++++------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 07b789e..e5b9de7 100644 --- a/Makefile +++ b/Makefile @@ -115,7 +115,10 @@ ifeq ($(UNAME),Darwin) SHARED_EXTENSION = dylib OS = macosx PD_PATH = /Applications/Pd-extended.app/Contents/Resources - OPT_CFLAGS = -ftree-vectorize -fast + OPT_CFLAGS = -ftree-vectorize +# uncomment this to build fat binaries + #FAT_BINARIES = 1 + ifdef FAT_BINARIES # build universal 32-bit on 10.4 and 32/64 on newer ifeq ($(shell uname -r | sed 's|\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*|\1|'), 8) FAT_FLAGS = -arch ppc -arch i386 -mmacosx-version-min=10.4 @@ -128,6 +131,7 @@ ifeq ($(UNAME),Darwin) FAT_FLAGS = -arch ppc -arch i386 -arch x86_64 -mmacosx-version-min=10.4 endif endif + endif ALL_CFLAGS += $(FAT_FLAGS) -fPIC -I/sw/include -I/opt/local/include # if the 'pd' binary exists, check the linking against it to aid with stripping BUNDLE_LOADER = $(shell test ! -e $(PD_PATH)/bin/pd || echo -bundle_loader $(PD_PATH)/bin/pd) diff --git a/pdlua.c b/pdlua.c index 0b126da..d1edeb9 100644 --- a/pdlua.c +++ b/pdlua.c @@ -78,6 +78,15 @@ # error "Pd version is too new, please file a bug report" #endif +#ifdef UNUSED +#elif defined(__GNUC__) +# define UNUSED(x) UNUSED_ ## x __attribute__((unused)) +#elif defined(__LCLINT__) +# define UNUSED(x) /*@unused@*/ x +#else +# define UNUSED(x) x +#endif + /* BAD: end of bad section */ /* If defined, PDLUA_DEBUG lets pdlua post a lot of text */ @@ -165,7 +174,7 @@ static void pdlua_pushatomtable (int argc, t_atom *argv); static t_pdlua *pdlua_new (t_symbol *s, int argc, t_atom *argv); /** Pd object destructor. */ static void pdlua_free (t_pdlua *o ); -static void pdlua_stack_dump (lua_State *L); +//static void pdlua_stack_dump (lua_State *L); /** a handler for the open item in the right-click menu (mrpeach 20111025) */ /** Here we find the lua code for the object and open it in an editor */ static void pdlua_menu_open (t_pdlua *o); @@ -250,7 +259,7 @@ static t_class *pdlua_proxyclock_class; /** Lua file reader callback. */ static const char *pdlua_reader ( - lua_State *L, /**< Lua interpreter state. */ + lua_State *UNUSED(L), /**< Lua interpreter state. */ void *rr, /**< Lua file reader state. */ size_t *size /**< How much data we have read. */ ) @@ -481,6 +490,7 @@ static void pdlua_free( t_pdlua *o /**< The object to destruct. */) return; } +#if 0 static void pdlua_stack_dump (lua_State *L) { int i; @@ -511,6 +521,7 @@ static void pdlua_stack_dump (lua_State *L) } printf("\n"); /* end the listing */ } +#endif /* nw.js support. If this is non-NULL then we're running inside Jonathan Wilkes' Pd-L2Ork variant and access to the GUI uses JavaScript. */ @@ -1588,7 +1599,7 @@ static int pdlua_loader_legacy static int pdlua_loader_pathwise ( - t_canvas *canvas, /**< Pd canvas to use to find the script. */ + t_canvas *UNUSED(canvas), /**< Pd canvas to use to find the script. */ const char *objectname, /**< The name of the script (without .pd_lua extension). */ const char *path /**< The directory to search for the script */ ) @@ -1659,10 +1670,10 @@ void pdlua_setup(void) post(compiled); post(luaversionStr); #else - logpost(NULL, 3, pdluaver); - logpost(NULL, 3, luaver); - logpost(NULL, 3, compiled); - logpost(NULL, 3, luaversionStr); + logpost(NULL, 3, "%s", pdluaver); + logpost(NULL, 3, "%s", luaver); + logpost(NULL, 3, "%s", compiled); + logpost(NULL, 3, "%s", luaversionStr); #endif pdlua_proxyinlet_setup(); PDLUA_DEBUG("pdlua pdlua_proxyinlet_setup done", 0); -- GitLab