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

Feature request: Configurable warnings #1597

Open
langston-barrett opened this issue Aug 23, 2020 · 3 comments
Open

Feature request: Configurable warnings #1597

langston-barrett opened this issue Aug 23, 2020 · 3 comments

Comments

@langston-barrett
Copy link
Contributor

Lots of compilers have a lot of configurability around the warnings they emit. A classic example would be gcc or clang, which have a number of great features:

  • Every warning has an individual toggle (the -W flags)
  • There are groups of warnings that can be mass-enabled depending on your level of pedantry (-Wall should basically always be used, -Wpedantic for the extra careful)
  • Warnings can be made into errors via a flag (-Werror), either individually or collectively.

It'd be great to get some of these features in Souffle!

@langston-barrett langston-barrett changed the title Configurable warnings Feature request: Configurable warnings Aug 23, 2020
@mmcgr
Copy link
Member

mmcgr commented Aug 24, 2020

There are some existing options when running souffle-compile that may help. souffle-compile -t adds -g -O0 -Wall -Wextra -Werror to the compilation flags. souffle-compile -w adds -Wall -Wextra to the compilation flags. CXXFLAGS="[your own custom settings]" souffle-compile will prepend your own flags.

These do require you to run souffle -g[name].cpp, then compile with souffle-compile [name].cpp instead of just souffle -c

@langston-barrett
Copy link
Contributor Author

I was thinking about warnings from Souffle itself, just using C compilers as an example (though it's good to know about those options to souffle-compile as well). I think it would be useful to (selectively) make warnings such as these into errors (for example, in CI).

Warning: Variable Config only occurs once in ./signatures.dl:185:40
Warning: No rules/facts defined for relation debuginfo_is_loaded in file entry.dl at line 2
.decl debuginfo_is_loaded()

@langston-barrett
Copy link
Contributor Author

Copying from #2319, the remaining steps for this feature are:

  • Turning specific/all warnings into errors (and demoting specific warnings from errors back into warnings).
  • Discoverability of warning flags (optimally via the CLI).
  • Allow warnings to default to "off".
  • Document flag behavior; currently "no" trumps "yes".
  • Make a .suppress-warning pragma, like .suppress-warnings except that it takes the name of a specific warning to suppress, and optimally can be specified multiple times (for different relations).

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

No branches or pull requests

3 participants