public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Sandra Loosemore <sandra@codesourcery.com>
To: Martin Sebor <msebor@gmail.com>, gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] document that alias and target must have the same type
Date: Thu, 13 Feb 2020 22:55:00 -0000	[thread overview]
Message-ID: <85d28ca7-bc65-ce67-ba1f-60e30fc376b5@codesourcery.com> (raw)
In-Reply-To: <55b2def7-1510-c54e-5089-509cdcf1d689@gmail.com>

On 2/5/20 1:13 PM, Martin Sebor wrote:

> diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
> index ec99c38a607..3634ce1c423 100644
> --- a/gcc/doc/extend.texi
> +++ b/gcc/doc/extend.texi
> @@ -2557,8 +2557,11 @@ __attribute__ ((access (write_only, 1, 2), access (read_write, 3))) int fgets (c
>  
>  @item alias ("@var{target}")
>  @cindex @code{alias} function attribute
> -The @code{alias} attribute causes the declaration to be emitted as an
> -alias for another symbol, which must be specified.  For instance,
> +The @code{alias} attribute causes the declaration to be emitted as an alias
> +for another symbol, which must have been previously declared with the same
> +type, and for variables same size and alignment.  Declaring an alias with
> +a different type than the target is undefined and may be diagnosed.  For
> +instance, an alias for another symbol, which must be specified.  For instance,
>  
>  @smallexample
>  void __f () @{ /* @r{Do something.} */; @}

This is kind of garbled.  Do you have an extraneous sentence beginning 
"For instance" in there?  It doesn't flow from the text you added before 
that.

> @@ -3919,31 +3922,41 @@ results in warning on line 5.
>  
>  @item weak
>  @cindex @code{weak} function attribute
> -The @code{weak} attribute causes the declaration to be emitted as a weak
> -symbol rather than a global.  This is primarily useful in defining
> -library functions that can be overridden in user code, though it can
> -also be used with non-function declarations.  Weak symbols are supported
> -for ELF targets, and also for a.out targets when using the GNU assembler
> -and linker.
> +The @code{weak} attribute causes a declaration of an external symbol
> +to be emitted as a weak symbol rather than a global.  This is primarily
> +useful in defining library functions that can be overridden in user code,
> +though it can also be used with non-function declarations.  The overriding
> +symbol must have the same type, and for variables size, and alignment as
> +the weak symbol.  Weak symbols are supported for ELF targets, and also for
> +a.out targets when using the GNU assembler and linker.

The "for variables" clause is awkward and has a comma in the wrong 
place.  I'd split this into a separate sentence, like

The overriding symbol must have the same type as the weak symbol.  If it 
is a variable it must also have the same size and alignment.

>  @item weakref
>  @itemx weakref ("@var{target}")
>  @cindex @code{weakref} function attribute
>  The @code{weakref} attribute marks a declaration as a weak reference.
>  Without arguments, it should be accompanied by an @code{alias} attribute
> -naming the target symbol.  Optionally, the @var{target} may be given as
> -an argument to @code{weakref} itself.  In either case, @code{weakref}
> -implicitly marks the declaration as @code{weak}.  Without a
> -@var{target}, given as an argument to @code{weakref} or to @code{alias},
> -@code{weakref} is equivalent to @code{weak}.
> +naming the target symbol.  Alernatively, @var{target} may be given as

s/Alernatively/Alternatively/

> +an argument to @code{weakref} itself, naming the target definition of
> +the alias.  The the @var{target} must have the same type, and for

s/The the/The/

> +variables also the same size and alignment as the declaration.  In either

Same comments above re splitting this into two sentences to avoid 
awkward wording.

The rest of this patch looks OK.

-Sandra

  parent reply	other threads:[~2020-02-13 22:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-05  1:05 Martin Sebor
2020-02-05 20:13 ` Martin Sebor
2020-02-12 21:02   ` [PING PATCH] " Martin Sebor
2020-02-13 22:55   ` Sandra Loosemore [this message]
2020-02-14 18:30     ` [PATCH] " Martin Sebor
2020-02-15  0:08       ` Sandra Loosemore
2020-02-13 22:45 ` Sandra Loosemore

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=85d28ca7-bc65-ce67-ba1f-60e30fc376b5@codesourcery.com \
    --to=sandra@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=msebor@gmail.com \
    /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).