ape/cc: silence -F and -B 'ignored' warnings#151
Conversation
-F comes from CFLAGS=-Fw in sys/src/ape/config (parsed as -F then -w by ARGBEGIN). Pass it through to the native compiler like -w/-N/-T. -B is passed explicitly by many mkfiles; cc.c already adds it internally when !Aflag. Accept it explicitly, set Aflag=1 to prevent the duplicate, and pass it to the compiler. Both previously fell to the default: case printing "flag ignored". https://claude.ai/code/session_01WGAwvvTwDg2yknFkmZ3qzs
There was a problem hiding this comment.
Code Review
This pull request introduces support for the -F and -B flags in the cc compiler wrapper. A critical issue was identified where setting Aflag = 1 for the -B flag would suppress necessary APE include paths, potentially causing compilation failures; the reviewer suggested simplifying the handling of the -B flag to avoid this side effect.
| case 'B': | ||
| append(&cc, "-B"); | ||
| Aflag = 1; | ||
| break; |
There was a problem hiding this comment.
Setting Aflag = 1 when the -B flag is encountered will suppress the automatic addition of the APE-specific include paths (e.g., -I/sys/include/ape) later in the code. In ape/cc, Aflag is the toggle for ANSI mode, which disables the APE environment. Since -B is often passed by mkfiles that still expect the APE environment, this change will cause compilation failures due to missing headers.
To silence the warning while preserving the correct behavior, you should simply break in the case 'B' block. The existing logic later in main will handle adding the -B flag and the necessary include paths if Aflag remains 0.
case 'B':
break;
-F comes from CFLAGS=-Fw in sys/src/ape/config (parsed as -F then -w by ARGBEGIN). Pass it through to the native compiler like -w/-N/-T.
-B is passed explicitly by many mkfiles; cc.c already adds it internally when !Aflag. Accept it explicitly, set Aflag=1 to prevent the duplicate, and pass it to the compiler.
Both previously fell to the default: case printing "flag ignored".
https://claude.ai/code/session_01WGAwvvTwDg2yknFkmZ3qzs