Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2000:
[Freeciv-Dev] Re: -ansi -pedantic, was Re: TODO
Home

[Freeciv-Dev] Re: -ansi -pedantic, was Re: TODO

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: -ansi -pedantic, was Re: TODO
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Sat, 23 Sep 2000 13:57:59 +1100 (EST)

Erik Sigra <freeciv@xxxxxxx> wrote:
> Falk Hueffner wrote:
> > Please don't; this is not portable, it's a gcc extension.
> 
> Since I didn't discover this, the flags "-ansi" and "-pedantic" must be
> missing in the Makefiles.

This comes up occasionally.  It turns out that unfortunately there are
problems using -ansi -pedantic by default, though it can be useful to
try (see next post).

The problems are:

- These flags are only useful with gcc (of course), but when we know
  we are using gcc (#if GCC) we sometimes deliberately use gcc-isms.
  In particular, use varargs macro in log.h, which then gives lots of
  warnings.

- Using -ansi changes some pre-defined macros, which can change the
  behaviour of included systems headers.  Eg, under linux I get things
  like:

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../intl  -DDEBUG  -g -Wall -ansi -pedantic 
-c support.c
support.c: In function `mystrcasecmp':
support.c:88: warning: implicit declaration of function `strcasecmp'

- I notice that the --with-included-gettext code fails under --ansi :-(

Also, note that gcc info pages say:

     Some users try to use `-pedantic' to check programs for strict ANSI
     C conformance.  They soon find that it does not do quite what they
     want: it finds some non-ANSI practices, but not all--only those
     for which ANSI C *requires* a diagnostic.

-- David



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