dmsc/fastbasic

clang warnings

polluks opened this issue · 2 comments

Compile src/compiler/os.cc
src/compiler/os.cc:130:28: warning: suggest braces around initialization of subobject [-Wmissing-braces]
    struct sigaction sa = {SIG_IGN, 0}, oldint, oldquit;
                           ^~~~~~~
                           {      }
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/signal.h:132:25: note: expanded from macro 'SIG_IGN'
#define SIG_IGN         (void (*)(int))1
                        ^~~~~~~~~~~~~~~~
src/compiler/os.cc:144:32: warning: suggest braces around initialization of subobject [-Wmissing-braces]
        struct sigaction sa = {SIG_DFL, 0};
                               ^~~~~~~
                               {      }
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/signal.h:131:25: note: expanded from macro 'SIG_DFL'
#define SIG_DFL         (void (*)(int))0
                        ^~~~~~~~~~~~~~~~
2 warnings generated.
dmsc commented

Hi!

This does not warn in Linux because it has a more correct definition, with the parentheses:

#define SIG_DFL	((__sighandler_t)0)

Can you test if writing SIG_IGN with parentheses outside woks?

struct sigaction sa = {(SIG_IGN), 0}, oldint, oldquit;

If it removes the warning, I can apply it as a fix.

Have Fun!

dmsc commented

Closing, no reply on a year.