public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Joseph S. Myers" <jsm28@cam.ac.uk>
To: Robert Dewar <dewar@gnat.com>
Cc: <fjh@cs.mu.oz.au>, <bernds@redhat.com>, <gcc@gcc.gnu.org>
Subject: Re: forcing tail/sibling call optimization
Date: Sun, 26 Nov 2000 16:21:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.30.0011262347580.18973-100000@kern.srcf.societies.cam.ac.uk> (raw)
In-Reply-To: <20001126234619.A52E534D80@nile.gnat.com>

On Sun, 26 Nov 2000, Robert Dewar wrote:

> I think there is real merit in providing fairly formal specifications
> for GNU C enhancements for three reasons.
>
> 1. The attempt to produce a FFS can often reveal difficulties that are
> not apparent in a less formal approach.
>
> 2. If other C compilers want to copy the feature, which I assume we
> welcome, then there is a clear guide.
>
> 3. If the ISO committee wants to copy the feature, which I assume
> we welcome, then there is a clear guide.

Indeed, it seems fairly impossible at present to work out what the
specification of most GNU C extensions is supposed to be.

A few months ago I noted problems with statement expressions.  (See c/772
for conclusions from that long discussion.)

Consider __attribute__, one of the most useful and widely used extensions.

The syntax is nowhere specified.  This was noted over three years ago
( http://bugs.debian.org/12253 - no documentation of where to put an
attribute on a function definition).

Attributes on labels seem not to be properly documented.  The docs for
-Wunused-label say you can put the "unused" attribute on a label, but the
syntax is nowhere stated.

Attributes do not work properly inside nested declarators - many of them
should apply to a function type but instead apply only to a function
declaration.  The grammar has them as parts of declarations instead of
parts of declarators, but function attributes clearly ought to be adding
alternatives to the productions "direct-declarator: direct-declarator (
parameter-type-list )" and "direct-declarator: direct-declarator (
identifier-list_opt )" (from C99).  Some attributes, if they can get
parsed, do get attached to the function type (e.g. noreturn), but others
don't; e.g. the format attributes work by adding to a list of format
functions stored by DECL_NAME and DECL_ASSEMBLER_NAME (for C++ mangled
names).

The rules for composite types and compatible types in the presence of
attributes are nowhere specified.  Different attributes need to work
differently here; those such as "const" and "format" that say more about
the type need to work differently from those such as "packed" that change
the type.  Some of this is implemented (e.g. the internal use of "const"
and "volatile" on function types is special cased to be different from
that on object types), but it isn't documented.

The grammar is also full of conflicts relating to attributes.  There used
to be a comment listing the conflicts that was removed because it was so
out of date, but their presence perhaps indicates lack of careful design.
Nowhere does the manual describe the conflicts and what the parsing rules
are supposed to be (ideally the intended rules were checked against the
parser resolution, but I strongly suspect that people have just increased
the %expect value to quiet Bison rather than checking carefully in each
case).

I strongly agree that GCC extensions should have formal specifications (in
the form of changes to the C99 or C++ grammar, as appropriate, plus
specifications of constraints, semantics, and undefined behaviour).

-- 
Joseph S. Myers
jsm28@cam.ac.uk

  reply	other threads:[~2000-11-26 16:21 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-26 15:46 Robert Dewar
2000-11-26 16:21 ` Joseph S. Myers [this message]
2000-11-26 18:08 ` Fergus Henderson
2000-11-26 21:50 ` Jeffrey A Law
  -- strict thread matches above, loose matches on Subject: below --
2000-11-29  4:58 Robert Dewar
2000-11-27 15:33 Mike Stump
2000-11-27 10:04 Robert Dewar
2000-11-27  9:39 Geert Bosch
2000-11-27 12:06 ` Jeffrey A Law
2000-11-27  9:08 Robert Dewar
2000-11-27  9:14 ` Bernd Schmidt
2000-11-27 10:09   ` Michael Matz
2000-11-27  8:44 Robert Dewar
2000-11-27  9:44 ` Jeffrey A Law
2000-11-27 10:22   ` Mark Probst
2000-11-27 14:42     ` Harvey J. Stein
2000-11-27 16:07       ` Mark Probst
2000-11-27 14:30   ` Harvey J. Stein
2000-11-26 18:09 Robert Dewar
2000-11-26 15:27 Robert Dewar
2000-11-26 17:56 ` Fergus Henderson
2000-11-26 10:59 Timothy J. Wood
2000-11-26  9:12 Geert Bosch
2000-11-26  8:21 Robert Dewar
2000-11-26 13:51 ` Fergus Henderson
2000-11-26  8:14 Robert Dewar
2000-11-26 13:43 ` Fergus Henderson
2000-11-27  7:58 ` Jeffrey A Law
2000-11-27  8:05   ` David Edelsohn
2000-11-27  8:07   ` Andi Kleen
2000-11-27  8:25     ` Jeffrey A Law
2000-11-27  8:39       ` Andi Kleen
2000-11-27  9:48         ` Jeffrey A Law
2000-11-27 11:21           ` Lars Brinkhoff
2000-11-27 10:54         ` Mark Mitchell
2000-11-27  8:38     ` Bernd Schmidt
2000-11-27 11:26       ` Eric W. Biederman
2000-11-27 10:48     ` Mark Mitchell
2000-11-27 12:46       ` Harvey J. Stein
2000-11-27 13:02         ` Travis Moulton
2000-11-27 10:47   ` Mark Mitchell
2000-11-28 19:21     ` Fergus Henderson
2000-11-29  2:09       ` Mark Mitchell
2000-11-30 23:59         ` Fergus Henderson
2000-12-01 15:51           ` Joe Buck
2001-01-03 12:24             ` Fergus Henderson
2001-01-03 13:09               ` Richard Henderson
2001-01-03 14:59                 ` Fergus Henderson
2001-01-03 15:32                   ` Richard Henderson
2001-01-03 15:53                     ` Fergus Henderson
2001-01-03 16:11                       ` Richard Henderson
2001-01-03 16:36                         ` Fergus Henderson
2002-09-14 23:35                   ` Fergus Henderson
2002-09-16  9:26                     ` Richard Henderson
2000-11-27 23:39   ` Fergus Henderson
2000-11-26  5:00 Robert Dewar
2000-11-26  7:44 ` Fergus Henderson
2000-11-26  8:18   ` Bernd Schmidt
2000-11-26  9:55   ` Andi Kleen
2000-11-26 11:34   ` Per Bothner
2000-11-26 11:55     ` Mark Probst
2000-11-26 17:40     ` Fergus Henderson
2000-11-26  3:56 Fergus Henderson
2000-11-26  5:22 ` Mark Probst

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.30.0011262347580.18973-100000@kern.srcf.societies.cam.ac.uk \
    --to=jsm28@cam.ac.uk \
    --cc=bernds@redhat.com \
    --cc=dewar@gnat.com \
    --cc=fjh@cs.mu.oz.au \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).