Jump to content
  • 0
Sign in to follow this  
bWolfie

returns_nonnull compiler warning

Question

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?

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);
   ^

 

Edited by bWolfie

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

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

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.