[Lldb-commits] [PATCH] D137503: [CMake] Fix -Wstrict-prototypes

2022-12-07 Thread Sam James via Phabricator via lldb-commits
thesamesam added a comment.

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


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137503/new/

https://reviews.llvm.org/D137503

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D137503: [CMake] Fix -Wstrict-prototypes

2022-12-07 Thread Sam James via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG32a2af44e1e8: [CMake] Fix -Wstrict-prototypes (authored by 
thesamesam).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137503/new/

https://reviews.llvm.org/D137503

Files:
  compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
  compiler-rt/cmake/config-ix.cmake
  compiler-rt/lib/builtins/CMakeLists.txt
  libcxx/cmake/config-ix.cmake
  libcxxabi/cmake/config-ix.cmake
  libunwind/cmake/config-ix.cmake
  lldb/tools/debugserver/source/CMakeLists.txt
  llvm/cmake/config-ix.cmake
  llvm/cmake/modules/FindFFI.cmake
  llvm/cmake/modules/FindTerminfo.cmake
  llvm/cmake/modules/FindZ3.cmake
  llvm/cmake/modules/HandleLLVMOptions.cmake
  openmp/runtime/cmake/config-ix.cmake
  polly/lib/External/CMakeLists.txt

Index: polly/lib/External/CMakeLists.txt
===
--- polly/lib/External/CMakeLists.txt
+++ polly/lib/External/CMakeLists.txt
@@ -64,7 +64,7 @@
 check_c_source_compiles("
 ${_includes}
 ${_type} typeVar;
-int main() {
+int main(void) {
 return 0;
 }
 " ${_variable})
@@ -73,7 +73,7 @@
 
   check_c_source_compiles("
   int func(void) __attribute__((__warn_unused_result__));
-  int main() { return 0; }
+  int main(void) { return 0; }
   " HAS_ATTRIBUTE_WARN_UNUSED_RESULT)
   set(GCC_WARN_UNUSED_RESULT)
   if (HAS_ATTRIBUTE_WARN_UNUSED_RESULT)
@@ -82,22 +82,22 @@
 
   check_c_source_compiles("
   __attribute__ ((unused)) static void foo(void);
-  int main() { return 0; }
+  int main(void) { return 0; }
   " HAVE___ATTRIBUTE__)
 
 
   check_c_source_compiles_numeric("
   #include 
-  int main() { (void)ffs(0); return 0; }
+  int main(void) { (void)ffs(0); return 0; }
   " HAVE_DECL_FFS)
 
   check_c_source_compiles_numeric("
-  int main() { (void)__builtin_ffs(0); return 0; }
+  int main(void) { (void)__builtin_ffs(0); return 0; }
   " HAVE_DECL___BUILTIN_FFS)
 
   check_c_source_compiles_numeric("
   #include 
-  int main() { (void)_BitScanForward(NULL, 0); return 0; }
+  int main(void) { (void)_BitScanForward(NULL, 0); return 0; }
   " HAVE_DECL__BITSCANFORWARD)
 
   if (NOT HAVE_DECL_FFS AND
@@ -109,12 +109,12 @@
 
   check_c_source_compiles_numeric("
   #include 
-  int main() { (void)strcasecmp(\"\", \"\"); return 0; }
+  int main(void) { (void)strcasecmp(\"\", \"\"); return 0; }
   " HAVE_DECL_STRCASECMP)
 
   check_c_source_compiles_numeric("
   #include 
-  int main() { (void)_stricmp(\"\", \"\"); return 0; }
+  int main(void) { (void)_stricmp(\"\", \"\"); return 0; }
   " HAVE_DECL__STRICMP)
 
   if (NOT HAVE_DECL_STRCASECMP AND NOT HAVE_DECL__STRICMP)
@@ -124,12 +124,12 @@
 
   check_c_source_compiles_numeric("
   #include 
-  int main() { (void)strncasecmp(\"\", \"\", 0); return 0; }
+  int main(void) { (void)strncasecmp(\"\", \"\", 0); return 0; }
   " HAVE_DECL_STRNCASECMP)
 
   check_c_source_compiles_numeric("
   #include 
-  int main() { (void)_strnicmp(\"\", \"\", 0); return 0; }
+  int main(void) { (void)_strnicmp(\"\", \"\", 0); return 0; }
   " HAVE_DECL__STRNICMP)
 
   if (NOT HAVE_DECL_STRNCASECMP AND NOT HAVE_DECL__STRNICMP)
@@ -139,12 +139,12 @@
 
   check_c_source_compiles_numeric("
   #include 
-  int main() { snprintf((void*)0, 0, \" \"); return 0; }
+  int main(void) { snprintf((void*)0, 0, \" \"); return 0; }
   " HAVE_DECL_SNPRINTF)
 
   check_c_source_compiles_numeric("
   #include 
-  int main() { _snprintf((void*)0, 0, \" \"); return 0; }
+  int main(void) { _snprintf((void*)0, 0, \" \"); return 0; }
   " HAVE_DECL__SNPRINTF)
 
   if (NOT HAVE_DECL_SNPRINTF AND NOT HAVE_DECL__SNPRINTF)
Index: openmp/runtime/cmake/config-ix.cmake
===
--- openmp/runtime/cmake/config-ix.cmake
+++ openmp/runtime/cmake/config-ix.cmake
@@ -27,7 +27,7 @@
 void func2() { printf(\"World\"); }
 __asm__(\".symver func1, func@VER1\");
 __asm__(\".symver func2, func@VER2\");
-int main() {
+int main(void) {
   func1();
   func2();
   return 0;
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -779,7 +779,7 @@
   # line is also a // comment.
   set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
   set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror -Wcomment")
-  CHECK_C_SOURCE_COMPILES("// \\n//\\nint main() {return 0;}"
+  CHECK_C_SOURCE_COMPILES("// \\n//\\nint main(void) {return 0;}"
   C_WCOMMENT_ALLOWS_LINE_WRAP)
   set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
   if (NOT C_WCOMMENT_ALLOWS_LINE_WRAP)
Index: 

[Lldb-commits] [PATCH] D137503: [CMake] Fix -Wstrict-prototypes

2022-12-07 Thread Sam James via Phabricator via lldb-commits
thesamesam created this revision.
thesamesam added reviewers: mgorny, aaron.ballman.
Herald added a reviewer: bollu.
Herald added subscribers: libcxx-commits, Enna1, pengfei.
Herald added projects: libunwind, All.
Herald added a reviewer: libunwind.
thesamesam requested review of this revision.
Herald added projects: Sanitizers, LLDB, libc++, OpenMP, libc++abi, LLVM.
Herald added subscribers: llvm-commits, openmp-commits, lldb-commits, 
Sanitizers.
Herald added a reviewer: libc++.
Herald added a reviewer: libc++abi.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137503

Files:
  compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
  compiler-rt/cmake/config-ix.cmake
  compiler-rt/lib/builtins/CMakeLists.txt
  libcxx/cmake/config-ix.cmake
  libcxxabi/cmake/config-ix.cmake
  libunwind/cmake/config-ix.cmake
  lldb/tools/debugserver/source/CMakeLists.txt
  llvm/cmake/config-ix.cmake
  llvm/cmake/modules/FindFFI.cmake
  llvm/cmake/modules/FindTerminfo.cmake
  llvm/cmake/modules/FindZ3.cmake
  llvm/cmake/modules/HandleLLVMOptions.cmake
  openmp/runtime/cmake/config-ix.cmake
  polly/lib/External/CMakeLists.txt

Index: polly/lib/External/CMakeLists.txt
===
--- polly/lib/External/CMakeLists.txt
+++ polly/lib/External/CMakeLists.txt
@@ -64,7 +64,7 @@
 check_c_source_compiles("
 ${_includes}
 ${_type} typeVar;
-int main() {
+int main(void) {
 return 0;
 }
 " ${_variable})
@@ -73,7 +73,7 @@
 
   check_c_source_compiles("
   int func(void) __attribute__((__warn_unused_result__));
-  int main() { return 0; }
+  int main(void) { return 0; }
   " HAS_ATTRIBUTE_WARN_UNUSED_RESULT)
   set(GCC_WARN_UNUSED_RESULT)
   if (HAS_ATTRIBUTE_WARN_UNUSED_RESULT)
@@ -82,22 +82,22 @@
 
   check_c_source_compiles("
   __attribute__ ((unused)) static void foo(void);
-  int main() { return 0; }
+  int main(void) { return 0; }
   " HAVE___ATTRIBUTE__)
 
 
   check_c_source_compiles_numeric("
   #include 
-  int main() { (void)ffs(0); return 0; }
+  int main(void) { (void)ffs(0); return 0; }
   " HAVE_DECL_FFS)
 
   check_c_source_compiles_numeric("
-  int main() { (void)__builtin_ffs(0); return 0; }
+  int main(void) { (void)__builtin_ffs(0); return 0; }
   " HAVE_DECL___BUILTIN_FFS)
 
   check_c_source_compiles_numeric("
   #include 
-  int main() { (void)_BitScanForward(NULL, 0); return 0; }
+  int main(void) { (void)_BitScanForward(NULL, 0); return 0; }
   " HAVE_DECL__BITSCANFORWARD)
 
   if (NOT HAVE_DECL_FFS AND
@@ -109,12 +109,12 @@
 
   check_c_source_compiles_numeric("
   #include 
-  int main() { (void)strcasecmp(\"\", \"\"); return 0; }
+  int main(void) { (void)strcasecmp(\"\", \"\"); return 0; }
   " HAVE_DECL_STRCASECMP)
 
   check_c_source_compiles_numeric("
   #include 
-  int main() { (void)_stricmp(\"\", \"\"); return 0; }
+  int main(void) { (void)_stricmp(\"\", \"\"); return 0; }
   " HAVE_DECL__STRICMP)
 
   if (NOT HAVE_DECL_STRCASECMP AND NOT HAVE_DECL__STRICMP)
@@ -124,12 +124,12 @@
 
   check_c_source_compiles_numeric("
   #include 
-  int main() { (void)strncasecmp(\"\", \"\", 0); return 0; }
+  int main(void) { (void)strncasecmp(\"\", \"\", 0); return 0; }
   " HAVE_DECL_STRNCASECMP)
 
   check_c_source_compiles_numeric("
   #include 
-  int main() { (void)_strnicmp(\"\", \"\", 0); return 0; }
+  int main(void) { (void)_strnicmp(\"\", \"\", 0); return 0; }
   " HAVE_DECL__STRNICMP)
 
   if (NOT HAVE_DECL_STRNCASECMP AND NOT HAVE_DECL__STRNICMP)
@@ -139,12 +139,12 @@
 
   check_c_source_compiles_numeric("
   #include 
-  int main() { snprintf((void*)0, 0, \" \"); return 0; }
+  int main(void) { snprintf((void*)0, 0, \" \"); return 0; }
   " HAVE_DECL_SNPRINTF)
 
   check_c_source_compiles_numeric("
   #include 
-  int main() { _snprintf((void*)0, 0, \" \"); return 0; }
+  int main(void) { _snprintf((void*)0, 0, \" \"); return 0; }
   " HAVE_DECL__SNPRINTF)
 
   if (NOT HAVE_DECL_SNPRINTF AND NOT HAVE_DECL__SNPRINTF)
Index: openmp/runtime/cmake/config-ix.cmake
===
--- openmp/runtime/cmake/config-ix.cmake
+++ openmp/runtime/cmake/config-ix.cmake
@@ -27,7 +27,7 @@
 void func2() { printf(\"World\"); }
 __asm__(\".symver func1, func@VER1\");
 __asm__(\".symver 

[Lldb-commits] [PATCH] D137503: [CMake] Fix -Wstrict-prototypes

2022-12-07 Thread Sam James via Phabricator via lldb-commits
thesamesam added a comment.
Herald added a reviewer: jdoerfert.
Herald added subscribers: sstefan1, JDevlieghere.

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


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137503/new/

https://reviews.llvm.org/D137503

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits