diff mbox

[rdma-core,2/7] Enable GNU99 mode if the compiler does not support C11

Message ID 20180209030904.22370-3-jgg@ziepe.ca (mailing list archive)
State Not Applicable
Headers show

Commit Message

Jason Gunthorpe Feb. 9, 2018, 3:08 a.m. UTC
From: Jason Gunthorpe <jgg@mellanox.com>

We have several places now that use C99 features and assume those
are enabled. Very old GCC's default to C89 and need to have C99 mode
enabled by command line, such as Centos 6. Fix building on those old
compilers by forcing C99 mode.

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
---
 buildlib/RDMA_EnableCStd.cmake | 2 ++
 1 file changed, 2 insertions(+)
diff mbox

Patch

diff --git a/buildlib/RDMA_EnableCStd.cmake b/buildlib/RDMA_EnableCStd.cmake
index c8a8c1f5530c13..c2e170929b7dde 100644
--- a/buildlib/RDMA_EnableCStd.cmake
+++ b/buildlib/RDMA_EnableCStd.cmake
@@ -49,6 +49,8 @@  function(RDMA_EnableCStd)
     CHECK_C_COMPILER_FLAG("-std=gnu11" SUPPORTS_GNU11)
     if (SUPPORTS_GNU11)
       SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11" PARENT_SCOPE)
+    else()
+      SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99" PARENT_SCOPE)
     endif()
   else()
     # Newer cmake can do this internally