🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #6017

Suggested modification/improvement to gcc/g++ (use of long long s)

#6017
From: Randy Smith
Date: Thu, 02 Jan 1997 00:00
51 lines
2738 bytes

    In the gcc/g++ manual, it says 

     `-pedantic' does not cause warning messages for use of the
     alternate keywords whose names begin and end with `__'.  Pedantic
     warnings are also disabled in the expression that follows
     `__extension__'.  However, only system header files should use
     these escape routes; application programs should avoid them.
     *Note Alternate Keywords::.

  Neither of these alternatives will work for accessing gcc's "long
  long" facility if you are compiling with -pedantic; there is no
  underscored version of "long long" and the "__extension__" keyword
  only works before primary expressions.  A minor modification to the
  parser will allow the use of __extension__ to enable "long long"s,
  at least in the global scope; the following is an example from the
  g++ 2.7.1 parser in the rules for the "extdef" tag:

*** ../../link/src/gcc_2_7_1/cp/parse.y      Fri Dec 01 18:36:22 1995
--- cp/parse.y  Mon Dec 16 11:44:12 1996
***************
*** 349,354 ****
--- 349,362 ----
                 { if (pending_inlines) do_pending_inlines (); }
         | datadef
               { if (pending_inlines) do_pending_inlines (); }
+        /* Allow datadef with a precedigin __extension__ to turn
+          off -pedantic.  This specifically gives a way to use
+           "long long"s.  */
+   | EXTENSION
+            { $<itype>1 = pedantic;
+                  pedantic = 0; }
+        datadef
+              { pedantic = $<itype>1; }
       | template_def
                  { if (pending_inlines) do_pending_inlines (); }
         | overloaddef


  This allows data definitions (including typedefs) to be declared
  long long at the top level, which allows use of long longs in
  -pedantic compiler programs.  Possibly creation of a __longlong__
  keyword would be more appropriate; certainly a complete fix would be
  preferable (i.e. the same modification in gcc as well as allowing
  long longs in function arguments and local variables).  But based on
  my understanding of the manual, some variation on this change would
  be appropriate; it might even be reasonable (though I know I'm
  stretching here) to consider it's lack a bug.

						-- Randy
Technical Details
Message-ID: <9701021808.AA22204@mordor.osf.org>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 113d02,7cda05967ffd2649,start
X-Google-Attributes: gid113d02,public
From: randys@osf.org (Randy Smith)
Subject: Suggested modification/improvement to gcc/g++ (use of long long s)
Date: 1997/01/02
Message-ID: <9701021808.AA22204@mordor.osf.org>
X-Deja-AN: 207313158
sender: bug-gcc-request@prep.ai.mit.edu
x-gateway: relay3.UU.NET from bug-gcc to gnu.gcc.bug; Thu, 2 Jan 1997 13:09:50 EST
newsgroups: gnu.gcc.bug