[Top][All Lists]

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

Re: Maintainer checks for non-c89 constructs?

From: Ben Pfaff
Subject: Re: Maintainer checks for non-c89 constructs?
Date: Sat, 09 Jun 2007 09:27:36 -0700
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

"James Youngman" <address@hidden> writes:

> GCC accepts this construct because it is (or can be) a c99 compiler.
> I find that about twice a year someone submits a bug report because
> I've accidentally used a non-c89 construct without noticing.   Is
> there any way I can use Automake to help me avoid this?

For this particular problem, you can write an Autoconf test to
check whether the C compiler accepts
-Wdeclaration-after-statement and use it if so.

In GNU PSPP we do it this way:

dnl Check whether a C compiler option is accepted.
dnl If so, add it to CFLAGS.
dnl Example: PSPP_ENABLE_OPTION(-Wdeclaration-after-statement)
  m4_define([pspp_cv_name], [pspp_cv_[]m4_translit([$1], [-], [_])])dnl
  AC_CACHE_CHECK([whether $CC accepts $1], [pspp_cv_name], 
     CFLAGS="$CFLAGS $1"
     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,)], [pspp_cv_name[]=yes], 
  if test $pspp_cv_name = yes; then


Ben Pfaff

reply via email to

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