dmsc / fastbasic

FastBasic - Fast BASIC interpreter for the Atari 8-bit computers
GNU General Public License v2.0
139 stars 20 forks source link

clang warnings #74

Closed polluks closed 7 months ago

polluks commented 1 year ago

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 1 year ago

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 7 months ago

Closing, no reply on a year.