From: Matthew Fernandez Date: Sat, 2 Jan 2021 18:33:43 +0000 (-0800) Subject: use C99 standard for compiling C code X-Git-Tag: 2.46.1~16^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fe3f9411d2c59b463ab1b64eecfd19f2db55d2fc;p=graphviz use C99 standard for compiling C code Closes #1833. --- diff --git a/CHANGELOG.md b/CHANGELOG.md index aa871e6a1..feaa8fc23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - CentOS/RHEL 6 is no longer supported - Vestiges of Qt4 support have been removed - C++11 support is now required of the C++ compiler used to build Graphviz +- C99 support is now required of the C compiler used to build Graphviz ### Fixed - memory leak in label construction diff --git a/CMakeLists.txt b/CMakeLists.txt index 59db6211f..923e111d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -174,6 +174,9 @@ add_custom_target(uninstall # =========================== Compiler configuration =========================== +set(CMAKE_C_STANDARD 99) +set(CMAKE_C_STANDARD_REQUIRED ON) + set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/configure.ac b/configure.ac index 6577caf1c..3f8c70789 100644 --- a/configure.ac +++ b/configure.ac @@ -310,6 +310,9 @@ dnl checks for compilers AM_PROG_CC_C_O AC_PROG_CC_C99 +if test "x$ac_cv_prog_cc_c99" = "xno"; then + AC_MSG_ERROR([C compiler does not support C99]) +fi AC_PROG_CXX AX_CXX_COMPILE_STDCXX_11(noext,mandatory) AC_PROG_OBJC diff --git a/rtest/test_examples.py b/rtest/test_examples.py index 1d6de61ce..2d665e945 100644 --- a/rtest/test_examples.py +++ b/rtest/test_examples.py @@ -44,7 +44,7 @@ def test_compile_example(src): subprocess.check_call([cc, filepath, '-Fe:', exe, '-nologo', rt_lib_option, '-link'] + ['{}.lib'.format(l) for l in libs]) else: - subprocess.check_call([cc, '-o', exe, filepath] + subprocess.check_call([cc, '-std=c99', '-o', exe, filepath] + ['-l{}'.format(l) for l in libs]) # FIXME: Remove skip of execution of neatopack.c example when diff --git a/rtest/test_regression.py b/rtest/test_regression.py index df27f1397..9b48a1b63 100644 --- a/rtest/test_regression.py +++ b/rtest/test_regression.py @@ -339,7 +339,8 @@ def test_1767(): rt_lib_option, '-link', 'cgraph.lib', 'gvc.lib']) else: cc = os.environ.get('CC', 'cc') - subprocess.check_call([cc, c_src, '-o', exe, '-lcgraph', '-lgvc']) + subprocess.check_call([cc, '-std=c99', c_src, '-o', exe, '-lcgraph', + '-lgvc']) # find our co-located dot input dot = os.path.abspath(os.path.join(os.path.dirname(__file__), '1767.dot'))