Skip to content

Simplify the warning-flag comments - #6265

Open
q10 wants to merge 1 commit into
pytorch:mainfrom
q10:export-D117107573
Open

Simplify the warning-flag comments#6265
q10 wants to merge 1 commit into
pytorch:mainfrom
q10:export-D117107573

Conversation

@q10

@q10 q10 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary:
NOTE: No linked task. Please associate a task with this diff.

Comments only. No flag changes.

The comments gave a full explanation for each flag, so the shared rules
appeared many times. This change states each rule once, in the header of its
list, and keeps a comment on a single flag only where that flag has a trap.

The rules that now appear once:

  • a flag in the portable list works on both compilers
  • g++ stops with an error when it gets an unknown -W option
  • a -Wno-error= line for a clang-only flag must stay in the clang list
  • the suppression lists come last, so they have priority
  • a -Wno-error= line does nothing if no list above enables the warning

The comments that remain describe traps that a reader cannot see from the
code: the plural spelling of -Wunused-local-typedefs, the flags that -Wall
includes on clang but not on gcc, and the correct way to repair a
-Wshift-sign-overflow site.

Each flag that does not stop the build now points to its -Wno-error= line,
and each -Wno-error= line gives the condition to remove it.

The text follows ASD-STE100: short sentences, active voice, present tense,
and one idea in each sentence.

The file goes from 694 to 529 lines. The comments go from 361 to 196 lines.

Differential Revision: D117107573

Summary:
NOTE: No linked task. Please associate a task with this diff.

Comments only. No flag changes.

The comments gave a full explanation for each flag, so the shared rules
appeared many times. This change states each rule once, in the header of its
list, and keeps a comment on a single flag only where that flag has a trap.

The rules that now appear once:
  - a flag in the portable list works on both compilers
  - g++ stops with an error when it gets an unknown `-W` option
  - a `-Wno-error=` line for a clang-only flag must stay in the clang list
  - the suppression lists come last, so they have priority
  - a `-Wno-error=` line does nothing if no list above enables the warning

The comments that remain describe traps that a reader cannot see from the
code: the plural spelling of `-Wunused-local-typedefs`, the flags that `-Wall`
includes on clang but not on gcc, and the correct way to repair a
`-Wshift-sign-overflow` site.

Each flag that does not stop the build now points to its `-Wno-error=` line,
and each `-Wno-error=` line gives the condition to remove it.

The text follows ASD-STE100: short sentences, active voice, present tense,
and one idea in each sentence.

The file goes from 694 to 529 lines. The comments go from 361 to 196 lines.

Differential Revision: D117107573
@meta-cla meta-cla Bot added the cla signed label Sep 4, 2026
@meta-codesync

meta-codesync Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

@q10 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D117107573.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant