Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Sep 2002 23:50:17 -0400 (EDT)
From:      Garrett Wollman <wollman@lcs.mit.edu>
To:        current@FreeBSD.org
Cc:        kan@FreeBSD.org
Subject:   No way to tell when `long long' is or is not supported?
Message-ID:  <200209090350.g893oHMs062192@khavrinen.lcs.mit.edu>

next in thread | raw e-mail | index | archive | help
GCC used to define a macro __STRICT_ANSI__ when `-ansi' was given on
the command line.  The current version does not do this, which breaks
detection of whether `long long' is allowed.  (For some reason this is
not hit in -current builds, but I have made some fixes to <stdlib.h>
which trigger it in every program which sets WARNS.)

Rather than trying to deduce whether `long long' is supported from
other macros, I simply modified the compiler driver to tell us.  (BTW,
the `-posix' flag is utterly useless and should go.)  If anyone has a
better way to accomplish this, I'm all ears.

(I suspect that the removal of __STRICT_ANSI__ was intentional, since
it's not clear what that should mean in the face of multiple C
language standards.  The trouble is that C89 (implied by `-ansi') is
otherwise indistinguishable from C89+GCC-extensions (implied by the
absence of `-ansi'), and we need to make both cases work properly.)

-GAWollman

Index: freebsd-spec.h
===================================================================
RCS file: /home/ncvs/src/contrib/gcc/config/freebsd-spec.h,v
retrieving revision 1.2
diff -u -r1.2 freebsd-spec.h
--- freebsd-spec.h	10 May 2002 19:05:07 -0000	1.2
+++ freebsd-spec.h	8 Sep 2002 18:34:29 -0000
@@ -85,12 +85,13 @@
    the final CPP_PREDEFINES value.  */
 
 #define FBSD_CPP_PREDEFINES \
-  "-D__FreeBSD__=5 -D__FreeBSD_cc_version=500003 -Dunix -D__KPRINTF_ATTRIBUTE__ -Asystem=unix -Asystem=bsd -Asystem=FreeBSD"
+  "-D__FreeBSD__=5 -D__FreeBSD_cc_version=500004 -Dunix -D__KPRINTF_ATTRIBUTE__ -Asystem=unix -Asystem=bsd -Asystem=FreeBSD"
 #endif	/* ! FREEBSD_NATIVE */
 
 
 /* Provide a CPP_SPEC appropriate for FreeBSD.  We just deal with the GCC 
-   option `-posix', and PIC issues.  */
+   option `-posix', and PIC issues.  Also deal with the problem of
+   detecting support for the `long long' type. */
 
 #define FBSD_CPP_SPEC "							\
   %(cpp_cpu)								\
@@ -98,6 +99,8 @@
   %{munderscores: -D__UNDERSCORES__}					\
   %{maout: %{!mno-underscores: -D__UNDERSCORES__}}			\
   %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__}		\
+  %{!ansi:%{!std=*:-D__LONG_LONG_SUPPORTED}%{std=gnu*:-D__LONG_LONG_SUPPORTED}}\
+  %{std=c99:-D__LONG_LONG_SUPPORTED}\
   %{posix:-D_POSIX_SOURCE}"
 
 /* Provide a STARTFILE_SPEC appropriate for FreeBSD.  Here we add

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209090350.g893oHMs062192>