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

ac_cv___attribute___printf_4_5 not set in CMake build system #509

Closed
Arfrever opened this issue Dec 23, 2019 · 2 comments · Fixed by #618
Closed

ac_cv___attribute___printf_4_5 not set in CMake build system #509

Arfrever opened this issue Dec 23, 2019 · 2 comments · Fixed by #618
Assignees
Labels
Milestone

Comments

@Arfrever
Copy link

configure.ac sets variables for three attributes:

# We only care about these two attributes.
if test x"$ac_cv___attribute__" = x"yes"; then
  ac_cv___attribute___noreturn="__attribute__ ((noreturn))"
  ac_cv___attribute___noinline="__attribute__ ((noinline))"
  ac_cv___attribute___printf_4_5="__attribute__((__format__ (__printf__, 4, 5)))"
else
  ac_cv___attribute___noreturn=
  ac_cv___attribute___noinline=
  ac_cv___attribute___printf_4_5=
fi

But CMakeLists.txt sets only two:

if (HAVE___ATTRIBUTE__)
  set (ac_cv___attribute___noreturn "__attribute__((noreturn))")
  set (ac_cv___attribute___noinline "__attribute__((noinline))")
elseif (HAVE___DECLSPEC)
  set (ac_cv___attribute___noreturn "__declspec(noreturn)")
  #set (ac_cv___attribute___noinline "__declspec(noinline)")
endif (HAVE___ATTRIBUTE__)

There is also unnecessary difference in presence/absence of space between __attribute__ and ((, which results in unnecessary difference between installed headers:

--- autotools-generated/glog/logging.h
+++ cmake-generated/glog/logging.h
@@ -652,7 +652,7 @@
 // Build the error message string. Specify no inlining for code size.
 template <typename T1, typename T2>
 std::string* MakeCheckOpString(const T1& v1, const T2& v2, const char* exprtext)
-    __attribute__ ((noinline));
+    __attribute__((noinline));
 
 namespace base {
 namespace internal {
@@ -1247,7 +1247,7 @@
   void SendToSyslogAndLog();  // Actually dispatch to syslog and the logs
 
   // Call abort() or similar to perform LOG(FATAL) crash.
-  static void __attribute__ ((noreturn)) Fail();
+  static void __attribute__((noreturn)) Fail();
 
   std::ostream& stream();
 
...
@Arfrever
Copy link
Author

@Arfrever
Copy link
Author

Updated patch: glog-ac_cv___attribute___.patch.txt

@sergiud: Since you dropped Autotools build system in #537 / #585, can you apply this patch to make CMake build system more feature-complete with now dropped Autotools build system?

@sergiud sergiud added the bug label Mar 30, 2021
@sergiud sergiud added this to the 0.5 milestone Mar 30, 2021
@sergiud sergiud self-assigned this Mar 30, 2021
@sergiud sergiud mentioned this issue May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants