Jump to content
  • 0
Sign in to follow this  
bWolfie

returns_nonnull compiler warning

Question

Posted (edited)

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

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