View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015203CMakeModulespublic2014-10-10 17:462015-07-08 08:57
ReporterPeter Wu 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake 3.0.2 
Target VersionCMake 3.2Fixed in VersionCMake 3.2 
Summary0015203: CheckStructHasMember breaks on -Wunused-value
DescriptionWhen CMAKE_C_FLAGS containg -Wall -Werror, CheckStructHasMember will always fail due to the generated code appearing as:

int main()
{
    struct FOO* s;
    s->MEMBER;
    return 0;
}

See the attached patch for a fix. Don't know whether some -std flag will also bail out on int main() rather than int main(void), but that's a different issue. This one is about breakage due to very strict warnings on a modern compiler (GCC 4.9.1).
TagsNo tags attached.
Attached Filespatch file icon 0001-CheckStructHasMember-avoid-breakage-on-Wall.patch [^] (776 bytes) 2014-10-10 17:46 [Show Content]
patch file icon 0001-CheckStructHasMember-avoid-clang-Wall-breakage.patch [^] (999 bytes) 2014-10-30 13:56 [Show Content]
patch file icon 0001-CheckStructHasMember-fix-null-deref-warning.patch [^] (941 bytes) 2015-02-15 18:27 [Show Content]

 Relationships
related to 0015413closedBrad King CheckStructHasMember generates an uninitialized variable warning 

  Notes
(0037024)
Brad King (manager)
2014-10-13 08:11

Applied, thanks:

 CheckStructHasMember: avoid breakage on -Wall -Werror
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=384d3ce7 [^]
(0037110)
Peter Wu (reporter)
2014-10-30 13:56
edited on: 2014-10-30 13:56

With -DCMAKE_C_COMPILER=clang and -Wall -Werror, clang will bail out with -Wuninitialized. Please find the new patch on top of the previous one.

(0037111)
Brad King (manager)
2014-10-30 14:17

Applied, thanks:

 CheckStructHasMember: Avoid clang -Wall breakage
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8d6ba358 [^]
(0037979)
Peter Wu (reporter)
2015-02-15 18:29

Clang Static Analyzer is great, but it results in defect reports due to the current macro. Hopefully this is the final patch.

It was successfully tested against Wireshark.
(0037981)
Brad King (manager)
2015-02-16 09:28

Re 0015203:0037979: This patch for the first time requires the struct to be allocated (on stack). When using LANGUAGE CXX this could be a problem if the structure does not have a default constructor or needs to link to symbols.

We need a solution that still goes through a pointer dereference so that no other requirements are checked.
(0038006)
Brad King (manager)
2015-02-20 10:42

The problem originally reported here has been addressed in CMake 3.2. The issue raised in 0015203:0037979 is separate and will have to be addressed in post-3.2 development. Please open a separate issue for that or just read CONTRIBUTING.rst and bring a patch to the mailing list.
(0039058)
Robert Maynard (manager)
2015-07-08 08:57

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2014-10-10 17:46 Peter Wu New Issue
2014-10-10 17:46 Peter Wu File Added: 0001-CheckStructHasMember-avoid-breakage-on-Wall.patch
2014-10-13 08:11 Brad King Note Added: 0037024
2014-10-14 10:04 Brad King Assigned To => Brad King
2014-10-14 10:04 Brad King Status new => resolved
2014-10-14 10:04 Brad King Resolution open => fixed
2014-10-14 10:04 Brad King Fixed in Version => CMake 3.1
2014-10-14 10:04 Brad King Target Version => CMake 3.1
2014-10-30 13:56 Peter Wu Note Added: 0037110
2014-10-30 13:56 Peter Wu Status resolved => feedback
2014-10-30 13:56 Peter Wu Resolution fixed => reopened
2014-10-30 13:56 Peter Wu File Added: 0001-CheckStructHasMember-avoid-clang-Wall-breakage.patch
2014-10-30 13:56 Peter Wu Note Edited: 0037110
2014-10-30 14:12 Brad King Status feedback => assigned
2014-10-30 14:12 Brad King Resolution reopened => open
2014-10-30 14:12 Brad King Fixed in Version CMake 3.1 =>
2014-10-30 14:12 Brad King Target Version CMake 3.1 => CMake 3.2
2014-10-30 14:17 Brad King Note Added: 0037111
2014-11-03 09:32 Brad King Status assigned => resolved
2014-11-03 09:32 Brad King Resolution open => fixed
2014-11-03 09:32 Brad King Fixed in Version => CMake 3.2
2015-02-15 18:27 Peter Wu File Added: 0001-CheckStructHasMember-fix-null-deref-warning.patch
2015-02-15 18:29 Peter Wu Note Added: 0037979
2015-02-15 18:29 Peter Wu Status resolved => feedback
2015-02-15 18:29 Peter Wu Resolution fixed => reopened
2015-02-16 09:28 Brad King Note Added: 0037981
2015-02-20 10:42 Brad King Note Added: 0038006
2015-02-20 10:42 Brad King Status feedback => resolved
2015-02-20 10:42 Brad King Resolution reopened => fixed
2015-02-20 11:24 Brad King Relationship added related to 0015413
2015-07-08 08:57 Robert Maynard Note Added: 0039058
2015-07-08 08:57 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team