Ericsson / clang

Cross Translation Unit analysis capability for Clang Static Analyzer. (Fork of official clang at http://llvm.org/git/clang)
http://clang.llvm.org/
Other
15 stars 10 forks source link

Make ODR diagnostics warning by default #551

Closed gamesh411 closed 5 years ago

gamesh411 commented 5 years ago

By default all odr-related diagnostics are considered warnings belonging to Diagnostic Group "Odr". They can be propagated to error level with -Werror=odr.

martong commented 5 years ago

Unfortunately, seems like we have a strange clang-tblgen assertion error in CI. :(

gamesh411 commented 5 years ago

I could build, and clang-test succeeded. OSX specific tests could still fail, as I cannot test on OSX locally. Maybe the CI should incorporate a test on OSX as well.

martong commented 5 years ago

I could build, and clang-test succeeded. OSX specific tests could still fail, as I cannot test on OSX locally. Maybe the CI should incorporate a test on OSX as well.

Yes, I agree.

But this time the CI error is with table-gen: http://ci1.codechecker.gic.ericsson.se:8080/job/ctu_pipeline_pullrequest/152/console

martong commented 5 years ago

run tests

balazske commented 5 years ago

Are these ODR warnings reported only from AST import related code or in other case when code is compiled? Is it possible that a case that was a compile error before the change is now only warning but the generated code is not correct? (The objective-c test cases may be the problematic ones.)

martong commented 5 years ago

Are these ODR warnings reported only from AST import related code or in other case when code is compiled?

This is valid. The only use case of StructuralEquivalenceContext out of the ASTImporter is in Sema::hasStructuralCompatLayout which is called from Sema::ActOnDuplicateDefinition which is used from ParseEnumSpecifier and from ParseClassSpecifier.

Now, making this a warning affects Clang. But there is not any lit test which we break here. This is not a fatal error, so the original behavior can be achieved by setting -WError=odr.

dkrupp commented 5 years ago

create upstream patch

martong commented 5 years ago

https://reviews.llvm.org/D55646