View Issue Details

IDProjectCategoryView StatusLast Update
0004904GNUnetportabilitypublic2019-02-28 11:17
ReporteramatusAssigned Toschanzen 
PrioritynormalSeverityminorReproducibilityN/A
Status closedResolutionfixed 
Product VersionSVN HEAD 
Target Version0.11.0Fixed in Version0.11.0 
Summary0004904: CFLAGS="-fshort-enums" reveals lots of problems with current usage of enums
DescriptionC does not specify the size of enum types, if compiled with gcc -fshort-enums most of our enums are no longer equivalent to int types and gcc warns about bad stuff we're doing.
Steps To Reproducemake CFLAGS="-fshort-enums"
Additional InformationSome warnings I get currently:

plugin_datastore_mysql.c: In function 'mysql_plugin_put':
plugin_datastore_mysql.c:333:35: warning: passing argument 1 of 'GNUNET_MY_query_param_uint32' from incompatible pointer type
     GNUNET_MY_query_param_uint32 (&type),
                                   ^
In file included from plugin_datastore_mysql.c:124:0:
../../src/include/gnunet_my_lib.h:347:1: note: expected 'const uint32_t *' but argument is of type 'enum GNUNET_BLOCK_Type *'
 GNUNET_MY_query_param_uint32 (const uint32_t *x);
 ^
plugin_datastore_mysql.c: In function 'mysql_plugin_get_key':
plugin_datastore_mysql.c:583:39: warning: passing argument 1 of 'GNUNET_MY_query_param_uint32' from incompatible pointer type
         GNUNET_MY_query_param_uint32 (&type),
                                       ^
In file included from plugin_datastore_mysql.c:124:0:
../../src/include/gnunet_my_lib.h:347:1: note: expected 'const uint32_t *' but argument is of type 'enum GNUNET_BLOCK_Type *'
 GNUNET_MY_query_param_uint32 (const uint32_t *x);
 ^
plugin_datastore_mysql.c:605:39: warning: passing argument 1 of 'GNUNET_MY_query_param_uint32' from incompatible pointer type
         GNUNET_MY_query_param_uint32 (&type),
                                       ^
In file included from plugin_datastore_mysql.c:124:0:
../../src/include/gnunet_my_lib.h:347:1: note: expected 'const uint32_t *' but argument is of type 'enum GNUNET_BLOCK_Type *'
 GNUNET_MY_query_param_uint32 (const uint32_t *x);
 ^
plugin_datastore_mysql.c:689:39: warning: passing argument 1 of 'GNUNET_MY_query_param_uint32' from incompatible pointer type
         GNUNET_MY_query_param_uint32 (&type),
                                       ^
In file included from plugin_datastore_mysql.c:124:0:
../../src/include/gnunet_my_lib.h:347:1: note: expected 'const uint32_t *' but argument is of type 'enum GNUNET_BLOCK_Type *'
 GNUNET_MY_query_param_uint32 (const uint32_t *x);
 ^
plugin_datastore_mysql.c:704:39: warning: passing argument 1 of 'GNUNET_MY_query_param_uint32' from incompatible pointer type
         GNUNET_MY_query_param_uint32 (&type),
                                       ^
In file included from plugin_datastore_mysql.c:124:0:
../../src/include/gnunet_my_lib.h:347:1: note: expected 'const uint32_t *' but argument is of type 'enum GNUNET_BLOCK_Type *'
 GNUNET_MY_query_param_uint32 (const uint32_t *x);
 ^
In file included from ../../src/include/platform.h:112:0,
                 from ats_api_performance.c:26:
ats_api_performance.c: In function 'GNUNET_ATS_performance_change_preference':
ats_api_performance.c:854:30: warning: 'enum GNUNET_ATS_PreferenceKind' is promoted to 'int' when passed through '...'
          (kind = va_arg (ap, enum GNUNET_ATS_PreferenceKind) ))
                              ^
ats_api_performance.c:854:30: note: (so you should pass 'int' not 'enum GNUNET_ATS_PreferenceKind' to 'va_arg')
ats_api_performance.c:854:30: note: if this code is reached, the program will abort
ats_api_performance.c:880:19: warning: 'enum GNUNET_ATS_PreferenceKind' is promoted to 'int' when passed through '...'
       va_arg (ap, enum GNUNET_ATS_PreferenceKind) ))
                   ^
ats_api_performance.c:880:19: note: if this code is reached, the program will abort
ats_api_performance.c: In function 'GNUNET_ATS_performance_give_feedback':
ats_api_performance.c:932:30: warning: 'enum GNUNET_ATS_PreferenceKind' is promoted to 'int' when passed through '...'
          (kind = va_arg (ap, enum GNUNET_ATS_PreferenceKind) ))
                              ^
ats_api_performance.c:932:30: note: if this code is reached, the program will abort
ats_api_performance.c:959:19: warning: 'enum GNUNET_ATS_PreferenceKind' is promoted to 'int' when passed through '...'
       va_arg (ap, enum GNUNET_ATS_PreferenceKind) ))
                   ^
ats_api_performance.c:959:19: note: if this code is reached, the program will abort
  CCLD libgnunetats.la
  CC plugin_ats_proportional.lo
plugin_ats_proportional.c: In function 'libgnunet_plugin_ats_proportional_init':
plugin_ats_proportional.c:1122:12: warning: assignment from incompatible pointer type
   sf.s_add = &GAS_proportional_address_add;
            ^
In file included from ../../src/include/platform.h:112:0,
                 from testbed_api_topology.c:26:
testbed_api_topology.c: In function 'GNUNET_TESTBED_overlay_configure_topology_va':
testbed_api_topology.c:1394:36: warning: 'enum GNUNET_TESTBED_TopologyOption' is promoted to 'int' when passed through '...'
     secondary_option = va_arg (va, enum GNUNET_TESTBED_TopologyOption);
                                    ^
testbed_api_topology.c:1394:36: note: (so you should pass 'int' not 'enum GNUNET_TESTBED_TopologyOption' to 'va_arg')
testbed_api_topology.c:1394:36: note: if this code is reached, the program will abort
testbed_api_topology.c: In function 'GNUNET_TESTBED_underlay_construct_':
testbed_api_topology.c:1555:29: warning: 'enum GNUNET_TESTBED_TopologyOption' is promoted to 'int' when passed through '...'
   topology = va_arg (vargs, enum GNUNET_TESTBED_TopologyOption);
                             ^
testbed_api_topology.c:1555:29: note: if this code is reached, the program will abort
In file included from ../../src/include/platform.h:112:0,
                 from fs_api.c:27:
fs_api.c: In function 'GNUNET_FS_start':
fs_api.c:3117:54: warning: 'enum GNUNET_FS_OPTIONS' is promoted to 'int' when passed through '...'
   while (GNUNET_FS_OPTIONS_END != (opt = va_arg (ap, enum GNUNET_FS_OPTIONS)))
                                                      ^
fs_api.c:3117:54: note: (so you should pass 'int' not 'enum GNUNET_FS_OPTIONS' to 'va_arg')
fs_api.c:3117:54: note: if this code is reached, the program will abort
TagsNo tags attached.

Activities

Christian Grothoff

2017-02-21 15:51

manager   ~0011800

Fixing the 'va_arg' issues will make the code ugly, maybe we should introduce a

#define GNUNET_VA_ARG_ENUM (va,X) ((enum X) va_arg (va, int))

to at least get the right 'enum' as the return value of 'va_arg'?

schanzen

2018-06-24 18:49

developer   ~0013072

fixed in 5de8b1d6e35e4c802cc25f7cbca7ba1154965b13

Issue History

Date Modified Username Field Change
2017-02-21 01:13 amatus New Issue
2017-02-21 15:51 Christian Grothoff Note Added: 0011800
2018-06-24 18:22 schanzen Assigned To => schanzen
2018-06-24 18:22 schanzen Status new => assigned
2018-06-24 18:49 schanzen Status assigned => resolved
2018-06-24 18:49 schanzen Resolution open => fixed
2018-06-24 18:49 schanzen Note Added: 0013072
2019-02-12 09:20 Christian Grothoff Target Version => 0.11.0
2019-02-20 12:24 Christian Grothoff Fixed in Version => 0.11.0
2019-02-28 11:17 Christian Grothoff Status resolved => closed