fastbasic icon indicating copy to clipboard operation
fastbasic copied to clipboard

clang warnings

Open polluks opened this issue 2 years ago • 1 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.

polluks avatar Jul 31 '23 16:07 polluks

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 avatar Jul 31 '23 19:07 dmsc

Closing, no reply on a year.

dmsc avatar Apr 23 '24 14:04 dmsc