This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Fix -Wstrict-prototypes
ClosedPublic

Authored by thesamesam on Nov 5 2022, 4:07 PM.

Details

Reviewers
mgorny
aaron.ballman
bollu
jdoerfert
phosek
MaskRay
Group Reviewers
Restricted Project
Restricted Project
Restricted Project
Commits
rG32a2af44e1e8: [CMake] Fix -Wstrict-prototypes
Summary

Fixes warnings (or errors, if someone injects -Werror in their build system,
which happens in fact with some folks vendoring LLVM too) with Clang 16:

+/var/tmp/portage.notmp/portage/sys-devel/llvm-15.0.4/work/llvm_build-abi_x86_64.amd64/CMakeFiles/CMakeTmp/src.c:3:9: warning: a function declaration without a prototype
is deprecated in all versions of C [-Wstrict-prototypes]
-/var/tmp/portage.notmp/portage/sys-devel/llvm-14.0.4/work/llvm_build-abi_x86_64.amd64/CMakeFiles/CMakeTmp/src.c:3:9: error: a function declaration without a prototype is
deprecated in all versions of C [-Werror,-Wstrict-prototypes]
 int main() {return 0;}
         ^
          void

Diff Detail

Event Timeline

thesamesam created this revision.Nov 5 2022, 4:07 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
Herald added a reviewer: Restricted Project. · View Herald Transcript
thesamesam requested review of this revision.Nov 5 2022, 4:07 PM
Herald added projects: Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project. · View Herald TranscriptNov 5 2022, 4:07 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Herald added a reviewer: Restricted Project. · View Herald Transcript
Herald added subscribers: llvm-commits, openmp-commits, lldb-commits, Restricted Project. · View Herald Transcript

Note that we of course don't have to bother doing this for C++ sources and test programs.

phosek accepted this revision.Nov 5 2022, 4:14 PM
phosek added a subscriber: phosek.

LGTM

MaskRay accepted this revision.Nov 5 2022, 4:29 PM
aaron.ballman accepted this revision.Nov 6 2022, 4:46 AM

LGTM, thank you for this! If we do a 15.0.5, I think these changes should probably go into there as well (WDYT?)

LGTM, thank you for this! If we do a 15.0.5, I think these changes should probably go into there as well (WDYT?)

I support this. This will make llvm-project 15.0.5 buildable by more future compilers.

This revision was not accepted when it landed; it landed in state Needs Review.Nov 7 2022, 5:37 PM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.

Thanks! Agreed -- I'll file the backport issue now.