bison-patches
[Top][All Lists]
Advanced

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

Excplict document and check for C99 compiler (Was: Patch to allow compil


From: Simon Sobisch
Subject: Excplict document and check for C99 compiler (Was: Patch to allow compilation with old compilers (VS 2008))
Date: Tue, 18 Sep 2018 19:41:25 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

Thank you Akim and Paul for your answers.

Am 18.09.2018 um 18:35 schrieb Paul Eggert:
> On 9/18/18 8:28 AM, Akim Demaille wrote:
>> Are you serious: VS2008, which was released almost ten years
>> after C99, does not support this basic feature of C99?  There’s
>> no way to ask for C99 support?
> 
> 
> The simplest and best way for MS-Windows developers to address this
> problem is to use GCC, e.g., with MinGW or Cygwin. If this can't be done
> (most likely for political reasons, often masquerading as technical),
> developers can upgrade to VS2013 or later; see
> <https://blogs.msdn.microsoft.com/vcblog/2013/06/28/c1114-stl-features-fixes-and-breaking-changes-in-vs-2013/>.
> If even *that* can't be done (my goodness, they must be in a political
> minefield!), they can build Bison on a decent platform and run the
> generated code on VS2008.
> 
> We should not revisit the decision to assume basic C99 features in a
> developer tool like Bison. It's been almost 20 years since C99 was made
> a standard and at this point VS2008 is approaching museum-piece status
> even among MS-Windows developers. Since GNU policy is to not waste
> significant time supporting non-free platforms, this decision is an easy
> call.

I'm perfectly fine with this decision, as long as it is both documented
and checked.

Note: I was told that the installed gnulib only supports VS2015 and above.


My main thought was that there are likely other old compilers that don't
support the declaration-after-statement syntax. But that should be
possible with C99 so nothing to do.


If C99 is needed (which is *perfectly* fine) configure should (as early
as possible) include a check for this.

What do you think about including the following to configure.ac [second
patch ;-)]?


 # Gnulib (early checks).
 gl_EARLY
+
+AC_MSG_CHECKING([C99 compiler])
+AC_LANG_PUSH([C])
+AC_COMPILE_IFELSE([
+  #include <stdint.h>
+  #include <limits.h>
+
+  int test (long long testvar) {
+    return (testvar > INT8_MAX);
+  }
+  ],
+  AC_MSG_RESULT([yes]),
+  AC_MSG_RESULT([no])
+  AC_MSG_NOTICE[Please build Bison with a reasonable compiler that
support C99]
+  AC_MSG_NOTICE[You may use the generated parsers with compilers that
support C90]
+  AC_MSG_ERROR[C99 compliant compiler needed]
+  )
+AC_LANG_POP([C])

 # Gnulib uses '#pragma GCC diagnostic push' to silence some
 # warnings, but older gcc doesn't support this.


And for README:


 ** Build
 See the file INSTALL for generic compilation and installation
 instructions.

+Bison requires C99 compiler to be built and a C90 compiler
+for generated parsers.
+
 Bison requires GNU m4 1.4.6 or later.  See:


Regards,
Simon



reply via email to

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