returns_nonnull compiler warning

bWolfie

I'm the man
Messages
850
Points
0
Location
Alberta, Midgard
Github
bWolfie
Emulator
Edit: I fixed nonnull and HPMHooking warnings by updating GCC to v7 (previously using default 4.8).

The enumeration value warning is a bit annoying. Using 'default' no longer suppresses the warning, so I have to manually input every enum value into each switch I use.

I recently updated my Hercules to 2022.12.07 and now I am receiving these warning messages when compiling.

How do I disable/fix them?

If I update to a later version will they automatically be fixed?

Code:
In file included from storage.c:37:0:
../common/memmgr.h:79:2: warning: ‘returns_nonnull’ attribute directive ignored [-Wattributes]
  void* (*malloc)(size_t size, const char *file, int line, const char *func) __attribute__ ((alloc_size (1))) GCCATTR ((returns_nonnull));

atcommand.c: In function ‘atcommand_go’:
atcommand.c:124:3: warning: enumeration value ‘BL_ITEM’ not handled in switch [-Wswitch-enum]
   switch (sd->who_hit) {
   ^
atcommand.c:124:3: warning: enumeration value ‘BL_SKILL’ not handled in switch [-Wswitch-enum]
  
  In file included from HPMHooking.c:238:0:
HPMHooking/HPMHooking_map.Hooks.inc: In function ‘HP_showmsg_showMessageV’:
HPMHooking/HPMHooking_map.Hooks.inc:81222:3: warning: function might be possible candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
   retVal___ = HPMHooks.source.showmsg.showMessageV(string, ap___copy);
   ^
 
Last edited by a moderator:
this warning added for protect against missing case blocks. In switches where not all cases must be present added macroses for disable this warning.

See lines with

PRAGMA_GCC46(GCC diagnostic push)
PRAGMA_GCC46(GCC diagnostic ignored "-Wswitch-enum")
// here switch and cases
PRAGMA_GCC46(GCC diagnostic pop)


but for this macroses need atleast gcc 4.6 or newer. 4.6 already dead version. If you using centos 7 you must updated your system, because this os is dead and outdated. select centos stream or switch to debian/ubuntu

 
Back
Top