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

[flang1] Fix compilation warnings; NFCI #1086

Conversation

bryanpkc
Copy link
Collaborator

Fix the Flang code base so that WITH_WERROR=on can be used at CMake time to enable stricter linting. This patch mainly addresses the following types of warnings:

  • -Wcast-qual warnings as a result of mixing char * fields and parameters with const char * values, especially string literals. Most of these can be trivially fixed by changing the type of the fields/parameters in question to const char *. Tricky cases are handled with explicit casts (e.g. of string literals to char *).

  • -Wunused-variable and -Wsometimes-uninitialized warnings. Unused variables are deleted, and ones that are used conditionally are initialized with sensible defaults.

  • -Wmissing-field-initializers warnings for partial initializers in data structure definitions.

  • -Wformat warnings (e.g. "%d" vs. "%ld", "%p" for non-void * arguments).

This patch depends on previous patches listed in #1065.

Fix the Flang code base so that WITH_WERROR=on can be used at CMake time to
enable stricter linting. This patch mainly addresses the following types of
warnings:

- -Wcast-qual warnings as a result of mixing (char *) fields and parameters
  with (const char *) values, especially string literals. Most of these can
  be trivially fixed by changing the type of the fields/parameters in question
  to (const char *). Tricky cases are handled with explicit casts (e.g. of
  string literals to (char *)).

- -Wunused-variable and -Wsometimes-uninitialized warnings. Unused variables
  are deleted, and ones that are used conditionally are initialized with
  sensible defaults.

- -Wmissing-field-initializers warnings for partial initializers in data
  structure definitions.

- -Wformat warnings (e.g. "%d" vs. "%ld", "%p" for non-(void *) arguments).
@bryanpkc bryanpkc force-pushed the fix-flang1-compilation-warnings branch from 5cb4433 to e939d38 Compare June 16, 2021 17:05
@bryanpkc bryanpkc marked this pull request as draft August 17, 2021 17:56
@bryanpkc bryanpkc closed this Feb 4, 2022
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.

1 participant