Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving options -Wall before extra_cxx_flags to resolve conflicting -Wno-XXX options for clang #945

Merged
merged 1 commit into from
Dec 6, 2023

Conversation

troy4eg
Copy link
Contributor

@troy4eg troy4eg commented Nov 27, 2023

Example:

int main() {
  int a = 7;
  int b;
  b = 10;
  return 0;
}

Output with -Wall:

$clang++-16 main.cpp -Wall
main.cpp:4:7: warning: unused variable 'a' [-Wunused-variable]
int a = 7;
^
main.cpp:5:7: warning: variable 'b' set but not used [-Wunused-but-set-variable]
int b;
^
2 warnings generated.

Output with -Wno-XXX and -Wall at the end:

$clang++-16 main.cpp -Wno-unused-variable -Wno-unused-but-set-variable -Wall
main.cpp:4:7: warning: unused variable 'a' [-Wunused-variable]
int a = 7;
^
main.cpp:5:7: warning: variable 'b' set but not used [-Wunused-but-set-variable]
int b;
^
2 warnings generated.

But if -Wall is before the other -Wno-XXX arguments, everything is compiled successfully

@troy4eg troy4eg added the small fix When it's not an huge enhancement label Nov 27, 2023
@troy4eg troy4eg added this to the next milestone Nov 27, 2023
@troy4eg troy4eg self-assigned this Nov 27, 2023
@troy4eg troy4eg force-pushed the troy4eg/improving_compiler_settings branch from 336a19e to b60d6a7 Compare November 27, 2023 15:52
@tolk-vm tolk-vm removed this from the next milestone Dec 6, 2023
@troy4eg troy4eg added this to the next milestone Dec 6, 2023
@troy4eg troy4eg merged commit 0a1b9f0 into master Dec 6, 2023
5 checks passed
@troy4eg troy4eg deleted the troy4eg/improving_compiler_settings branch December 6, 2023 15:42
DedAzaMarks pushed a commit to DedAzaMarks/kphp that referenced this pull request Dec 13, 2023
mt-omarov pushed a commit to mt-omarov/kphp that referenced this pull request Feb 26, 2024
mt-omarov pushed a commit to mt-omarov/kphp that referenced this pull request Feb 26, 2024
mt-omarov pushed a commit to mt-omarov/kphp that referenced this pull request Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
small fix When it's not an huge enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants