Skip to content

ape/cc: silence -F and -B 'ignored' warnings#151

Merged
staalmannen merged 1 commit into
mainfrom
claude/upgrade-ape-c-library-mmZGd
May 23, 2026
Merged

ape/cc: silence -F and -B 'ignored' warnings#151
staalmannen merged 1 commit into
mainfrom
claude/upgrade-ape-c-library-mmZGd

Conversation

@staalmannen

Copy link
Copy Markdown
Owner

-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

-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
@staalmannen staalmannen merged commit 46cedd5 into main May 23, 2026
1 check passed

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread sys/src/ape/9src/cc.c
Comment on lines +128 to +131
case 'B':
append(&cc, "-B");
Aflag = 1;
break;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants