[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: no-c++.m4: bug fix: egrep: repetition-operator operand invalid

From: Bruno Haible
Subject: Re: no-c++.m4: bug fix: egrep: repetition-operator operand invalid
Date: Wed, 06 Dec 2017 02:12:17 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-101-generic; KDE/5.18.0; x86_64; ; )

Sam Steingold wrote:
> On Darwin (Mac OS) the gt_NO_CXX test fails because "Is g++" is not a
> valid repetition-operator operand.
> The attached patch fixes the problem.

Thanks. There is also another problem in this macro: Since a preprocessor
is allowed to insert additional spaces, it may transform the line
    Is g++
    Is   g++
Therefore we should also avoid spaces in AC_EGREP_CPP patterns.

Note about your comment "So far only g++ and clang++ are supported.":
While technically you are right, in gnulib we prefer to see clang as a
gcc compatible compiler. So, when we write "test for GCC" we implicitly
mean "test for GCC (or clang, which is GCC compatible)".
  * In configure scripts, 'test -n "$GCC"' is true for clang.
  * clang has GCC-compatible options for warnings and many other things.

Applied as follows.

2017-12-05  Sam Steingold  <address@hidden>
            Bruno Haible  <address@hidden>

        no-c++: Avoid "egrep: repetition-operator operand invalid" error.
        * m4/no-c++.m4 (gt_NO_CXX): Don't use '+' characters nor spaces in the
        AC_EGREP_CPP pattern.

diff --git a/m4/no-c++.m4 b/m4/no-c++.m4
index ed06b22..cf63f6d 100644
--- a/m4/no-c++.m4
+++ b/m4/no-c++.m4
@@ -1,4 +1,4 @@
-# no-c++.m4 serial 1
+# no-c++.m4 serial 2
 dnl Copyright (C) 2006, 2009-2017 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -7,14 +7,14 @@ dnl with or without modifications, as long as this notice is 
 # Support for C source files that cannot be compiled by a C++ compiler.
 # Set NO_CXX to the C++ compiler flags needed to request C mode instead of
 # C++ mode.
-# So far only g++ is supported.
+# So far only g++ is supported. This includes clang++, as it is g++ compatible.
-  AC_EGREP_CPP([Is g++], [
+  AC_EGREP_CPP([Is_g_plus_plus], [
 #if defined __GNUC__ && defined __cplusplus
-  Is g++
+  Is_g_plus_plus
     [NO_CXX="-x c"])

reply via email to

[Prev in Thread] Current Thread [Next in Thread]