autoconf
[Top][All Lists]
Advanced

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

Re: Problem in Tru64 with autoconf choosen cc flags [PATCH]


From: Nicolás Lichtmaier
Subject: Re: Problem in Tru64 with autoconf choosen cc flags [PATCH]
Date: Wed, 14 Jan 2004 17:05:46 -0300
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031107 Debian/1.5-3


In Tru64 autoconf likes to select "-std1" as the flag to get an ANSI
compiler.

I think that change was proposed by Kevin Ryde in June
<http://mail.gnu.org/archive/html/autoconf-patches/2003-06/msg00009.html>
and was later installed into Autoconf.  The problem is that plain "cc"
mishandles \x escapes in strings.

The problem is that this is similar to the "-ansi" switch in
GCC, and it turns off useful extensions.

What extensions are these?  Is this documented anywhere?

The normal and recommended switch would be just "-std".

Besides \x,
<http://groups.google.com/groups?selm=9ro8ef%2427l6%241%40FreeBSD.csie.NCTU.edu.tw>
says that Tru64 "cc -std" defines __STDC__ to be 0.  It's clearly more
conservative to use -std1, but perhaps if -std1 disables some useful
extensions then we should revisit this issue.
This is an excerpt from the cc(1) manpage:

 -std
Selects the relaxed ANSI language mode. Enforces the ANSI C standard,
      but allows some common programming practices disallowed by the stan-
      dard.
This option does not restrict the Tru64 UNIX name space (for example, the names defined in system header files). To restrict that name space so that only ANSI C reserved names are visible from the ANSI C header files, use the _ANSI_C_SOURCE macro. See standards(5) for more details. This option causes the macro __STDC_ to be defined to 0. -std0 Selects the K & R language mode. This is the default. Enforces the K & R programming style, with certain ANSI extensions in areas where the K & R behavior is undefined or ambiguous. In general, -std0 compiles most
      pre-ANSI C programs and produces expected results. The -std0 option
      causes the __STDC__ macro to be undefined.
-std1
      Selects the strict ANSI language mode. Strictly enforces the ANSI C
standard and all its prohibitions (such as those that apply to the han- dling of void types, the definition of lvalues in expressions, the mix-
      ing of integrals and pointers, and the modification of rvalues).
This option does not restrict the Tru64 UNIX name space (for example, the names defined in system header files). To restrict that name space so that only ANSI C reserved names are visible from the ANSI C header files, use the _ANSI_C_SOURCE macro. See standards(5) for more details. This option causes the macro __STDC_ to be defined to 1. Note that this option also affects linker-defined symbols. See ld(1) for more infor-
      mation.
This option, combined with -O3 or higher, turns on ANSI aliasing rules
      (-ansi_alias option).


So it seems to me that the retionale for definining __STDC__ to 0 is:
"We allow code which is not strictly ANSI in this mode". This is also
true for the normal gcc mode!

--
Nicolás Lichtmaier.-
Synapsis Argentina
+54(11)4314-3000 (int. 231)






reply via email to

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