From 09eb991f6f517f37988d2d33bfdb815084f374aa Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Sat, 31 Mar 2018 10:57:08 -0400 Subject: [PATCH 1/4] build/liblsd: add -Wno-parentheses for gcc7 Problem: liblsd/list.c fails to compile due to a new gcc7 "no-parentheses" warning. Add -Wno-parentheses to ignore this warning since liblsd was imported from another source. --- src/common/liblsd/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/liblsd/Makefile.am b/src/common/liblsd/Makefile.am index dca2f9380..0aa5e8d7c 100644 --- a/src/common/liblsd/Makefile.am +++ b/src/common/liblsd/Makefile.am @@ -1,5 +1,6 @@ AM_CFLAGS = \ $(WARNING_CFLAGS) \ + -Wno-parentheses \ $(CODE_COVERAGE_CFLAGS) AM_LDFLAGS = \ From a6c3b5a9257b3bf2d332f29a2ecc091b767987a0 Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Sat, 31 Mar 2018 11:02:30 -0400 Subject: [PATCH 2/4] rdl: [cleanup] expand tabs in lua-cpuset.c Problem: rdl/lua-cpuset.c fails to compile due to a new gcc7 misleading-indentation error. The "problem" seems to come simply from inconsistent use of tabs vs spaces for indentation. Since expandtab is set in the modeline, just convert all tabs to spaces in that file. --- rdl/lua-cpuset.c | 64 ++++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/rdl/lua-cpuset.c b/rdl/lua-cpuset.c index 775f87d5c..e36bd23d5 100644 --- a/rdl/lua-cpuset.c +++ b/rdl/lua-cpuset.c @@ -41,8 +41,8 @@ static cpu_set_t * l_cpu_set_alloc (lua_State *L) { cpu_set_t *setp = lua_newuserdata (L, sizeof (*setp)); - luaL_getmetatable (L, "CpuSet"); - lua_setmetatable (L, -2); + luaL_getmetatable (L, "CpuSet"); + lua_setmetatable (L, -2); return (setp); } @@ -120,48 +120,48 @@ static int l_cpu_set_new (lua_State *L) static int l_cpu_set_count (lua_State *L) { - int i, n; - cpu_set_t *setp = lua_to_cpu_setp (L, 1); + int i, n; + cpu_set_t *setp = lua_to_cpu_setp (L, 1); n = 0; - for (i = 0; i < CPU_SETSIZE; i++) - if (CPU_ISSET (i, setp)) n++; + for (i = 0; i < CPU_SETSIZE; i++) + if (CPU_ISSET (i, setp)) n++; - lua_pushnumber (L, n); - return (1); + lua_pushnumber (L, n); + return (1); } static void cpu_set_union (cpu_set_t *setp, cpu_set_t *s) { - int i; - for (i = 0; i < CPU_SETSIZE; i++) { - if (CPU_ISSET (i, s)) - CPU_SET (i, setp); - } + int i; + for (i = 0; i < CPU_SETSIZE; i++) { + if (CPU_ISSET (i, s)) + CPU_SET (i, setp); + } } static int l_cpu_set_union (lua_State *L) { - cpu_set_t *setp; - int i; - int nargs = lua_gettop (L); + cpu_set_t *setp; + int i; + int nargs = lua_gettop (L); /* Accumulate results in first cpu_set */ if (!(setp = lua_to_cpu_setp (L, 1))) return (2); - for (i = 2; i < nargs+1; i++) { + for (i = 2; i < nargs+1; i++) { cpu_set_t *arg = lua_to_cpu_setp (L, i); if (arg == NULL) return (2); - cpu_set_union (setp, arg); + cpu_set_union (setp, arg); } /* * Return first cpu_set object (set stack top to position 1): */ - lua_settop (L, 1); - return (1); + lua_settop (L, 1); + return (1); } static void cpu_set_intersect (cpu_set_t *setp, cpu_set_t *s) @@ -614,21 +614,21 @@ int lua_get_affinity (lua_State *L) } static const struct luaL_Reg cpu_set_functions [] = { - { "new", l_cpu_set_new }, + { "new", l_cpu_set_new }, { "union", l_cpu_set_union }, { "intersect", l_cpu_set_intersect }, - { NULL, NULL }, + { NULL, NULL }, }; static const struct luaL_Reg cpu_set_methods [] = { { "__eq", l_cpu_set_equals }, - { "__len", l_cpu_set_count }, - { "__add", l_cpu_set_add }, - { "__sub", l_cpu_set_subtract }, - { "__concat", l_cpu_set_strconcat }, - { "__tostring", l_cpu_set_tostring }, - { "__index", l_cpu_set_index }, - { "__newindex", l_cpu_set_newindex }, + { "__len", l_cpu_set_count }, + { "__add", l_cpu_set_add }, + { "__sub", l_cpu_set_subtract }, + { "__concat", l_cpu_set_strconcat }, + { "__tostring", l_cpu_set_tostring }, + { "__index", l_cpu_set_index }, + { "__newindex", l_cpu_set_newindex }, { "set", l_cpu_set_set }, { "clr", l_cpu_set_delete }, { "isset", l_cpu_set_isset }, @@ -645,13 +645,13 @@ static const struct luaL_Reg cpu_set_methods [] = { { "first", l_cpu_set_first }, { "last", l_cpu_set_last }, { "tohex", l_cpu_set_tohex }, - { NULL, NULL }, + { NULL, NULL }, }; int luaopen_cpuset (lua_State *L) { - luaL_newmetatable (L, "CpuSet"); - luaL_register (L, NULL, cpu_set_methods); + luaL_newmetatable (L, "CpuSet"); + luaL_register (L, NULL, cpu_set_methods); luaL_register (L, "cpu_set", cpu_set_functions); /* From 76bf76cc39c1725a6f8673e8eeb76e7b959d9f93 Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Sat, 31 Mar 2018 11:18:59 -0400 Subject: [PATCH 3/4] resrc: fix format errors Problem: gcc7 (i386) reports a mismatch between size_t values and PRIu64 printf format strings. Use %zd format for size_t. --- resrc/resrc.c | 6 +++--- resrc/resrc_reqst.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resrc/resrc.c b/resrc/resrc.c index 51283ef25..536f52c25 100644 --- a/resrc/resrc.c +++ b/resrc/resrc.c @@ -1043,7 +1043,7 @@ char *resrc_to_string (resrc_t *resrc) uuid_unparse (resrc->uuid, uuid); fprintf (ss, "resrc type: %s, path: %s, basename: %s, name: %s, digest: %s, " "id: %"PRId64", state: %s, " - "uuid: %s, size: %"PRIu64", avail: %"PRIu64"", + "uuid: %s, size: %zd, avail: %zd", resrc->type, resrc->path, resrc->basename, resrc->name, resrc->digest, resrc->id, resrc_state (resrc), uuid, resrc->size, resrc->available); @@ -1068,7 +1068,7 @@ char *resrc_to_string (resrc_t *resrc) fprintf (ss, ", allocs"); size_ptr = zhash_first (resrc->allocs); while (size_ptr) { - fprintf (ss, ", %s: %"PRIu64"", + fprintf (ss, ", %s: %zd", (char *)zhash_cursor (resrc->allocs), *size_ptr); size_ptr = zhash_next (resrc->allocs); } @@ -1077,7 +1077,7 @@ char *resrc_to_string (resrc_t *resrc) fprintf (ss, ", reserved"); size_ptr = zhash_first (resrc->reservtns); while (size_ptr) { - fprintf (ss, ", %s: %"PRIu64"", + fprintf (ss, ", %s: %zd", (char *)zhash_cursor (resrc->reservtns), *size_ptr); size_ptr = zhash_next (resrc->reservtns); } diff --git a/resrc/resrc_reqst.c b/resrc/resrc_reqst.c index 9a3244c88..a09fdcb30 100644 --- a/resrc/resrc_reqst.c +++ b/resrc/resrc_reqst.c @@ -378,7 +378,7 @@ void resrc_graph_req_print (resrc_graph_req_t *graph_reqst) if (graph_reqst) { printf (" requestng graphs of:"); while (graph_reqst->name) { - printf (" name: %s: size: %ld,", graph_reqst->name, + printf (" name: %s: size: %zd,", graph_reqst->name, graph_reqst->size); graph_reqst++; } From e8d1e5bdc54f70d5e045e627d02da040a9ba72b9 Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Sat, 31 Mar 2018 11:25:01 -0400 Subject: [PATCH 4/4] simulator: fix format error Problem: 64-bit integer id is printed with %lu, causing gcc7 format error. Use PRId64 instead. --- simulator/submitsrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simulator/submitsrv.c b/simulator/submitsrv.c index 87c748125..3376d2685 100644 --- a/simulator/submitsrv.c +++ b/simulator/submitsrv.c @@ -260,7 +260,7 @@ int schedule_next_job (flux_t *h, sim_state_t *sim_state) // Update lwj.%jobid%'s state in the kvs to "submitted" if (!(dir = job_kvsdir (h, new_jobid))) - log_err_exit ("kvs_get_dir (id=%lu)", new_jobid); + log_err_exit ("kvs_get_dir (id=%"PRId64")", new_jobid); job->kvs_dir = dir; if (put_job_in_kvs (job, "submitted") < 0) log_err_exit ("put_job_in_kvs");