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

Configurable warnings #2319

Merged
merged 6 commits into from
Oct 27, 2022
Merged

Conversation

langston-barrett
Copy link
Contributor

@langston-barrett langston-barrett commented Oct 14, 2022

First steps towards #1597: Give all warnings a name and allow enabling or disabling specific warnings at the command line.

Next steps feature-wise 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).

Here's a simple program that can be used to test these changes:

// No rules/facts warning
.decl a(X: number)
.output a(IO=stdout)

// Dollar sign warning
.decl d(X: number)
d($) :- a(0).

I'm seeing this error in CI which I don't understand:

/home/runner/work/souffle/souffle/src/reports/ErrorReport.cpp:35:36: error: ‘<anonymous>’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   35 |     return std::optional<WarnType>();
      |                                    ^

Obviously, there's no variable named <anonymous>, and it looks like a valid use of the std::optional constructor to me...

Give all warnings a name and allow enabling or disabling specific
warnings at the command line.

A good next step code-wise would be to make the WarnSet type synonym
into its own class that encapsulates more warning-related functionality.

Next steps feature-wise 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 the .suppress-warnings pragma take the name of a specific warning
  to suppress.

Here's a simple program that can be used to test these changes:

  // No rules/facts warning
  .decl a(X: number)
  .output a(IO=stdout)

  // Dollar sign warning
  .decl d(X: number)
  d($) :- a(0).
Next step: Revert changes to test files in the previous commit, since the
default constructor has the desired behavior of enabling all warnings.
The default constructor now encodes the desired behavior, namely, enabling all
warnings by default.
@julienhenry
Copy link
Member

julienhenry commented Oct 15, 2022

Obviously, there's no variable named , and it looks like a valid use of the std::optional constructor to me...

How about returning std::nullopt instead ?

@quentin
Copy link
Member

quentin commented Oct 15, 2022

Obviously, there's no variable named <anonymous>, and it looks like a valid use of the std::optional constructor to me...

Might be this bug, fixed in gcc 11 but the CI is using gcc 9.4: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635

Avoids erroneous compiler warning about an unused variable.
@codecov
Copy link

codecov bot commented Oct 15, 2022

Codecov Report

Merging #2319 (9f37121) into master (ba99149) will decrease coverage by 0.07%.
The diff coverage is 48.19%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2319      +/-   ##
==========================================
- Coverage   77.39%   77.32%   -0.08%     
==========================================
  Files         461      469       +8     
  Lines       29004    29245     +241     
==========================================
+ Hits        22448    22614     +166     
- Misses       6556     6631      +75     
Impacted Files Coverage Δ
src/parser/ParserDriver.h 100.00% <ø> (ø)
src/reports/ErrorReport.cpp 12.50% <12.50%> (ø)
src/main.cpp 69.21% <60.00%> (-0.51%) ⬇️
src/ast/transform/SemanticChecker.cpp 97.00% <100.00%> (+0.02%) ⬆️
src/parser/ParserDriver.cpp 90.24% <100.00%> (ø)
src/ram/transform/MakeIndex.cpp 86.25% <100.00%> (ø)
src/reports/ErrorReport.h 100.00% <100.00%> (ø)
src/include/souffle/io/ReadStreamCSV.h 82.05% <0.00%> (-3.51%) ⬇️
src/include/souffle/utility/SubProcess.h 78.94% <0.00%> (-2.64%) ⬇️
...st/transform/SimplifyAggregateTargetExpression.cpp 97.77% <0.00%> (-2.23%) ⬇️
... and 37 more

@b-scholz
Copy link
Member

There is still one tiny issue outstanding w.r.t. the formatting of the source code.

Please, can you either apply this diff,

https://github.com/souffle-lang/souffle/actions/runs/3256815864/jobs/5347660548

or run the clang-format tool.

Copy link
Member

@b-scholz b-scholz left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!

@b-scholz b-scholz merged commit 1fc233d into souffle-lang:master Oct 27, 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.

4 participants