diff options
author | Martin Sebor <msebor@redhat.com> | 2017-09-21 17:19:16 +0000 |
---|---|---|
committer | Martin Sebor <msebor@gcc.gnu.org> | 2017-09-21 11:19:16 -0600 |
commit | 2bc668c2749292460764d0474707ece913038fbc (patch) | |
tree | 1dfb12d2e90f9a20a2870325e76e2e65253f10cd /gcc | |
parent | 7cd7dbdadf181dd79a933fee387364b24558058e (diff) | |
download | gcc-2bc668c2749292460764d0474707ece913038fbc.zip gcc-2bc668c2749292460764d0474707ece913038fbc.tar.gz gcc-2bc668c2749292460764d0474707ece913038fbc.tar.bz2 |
PR c/81882 - attribute ifunc documentation uses invalid code
gcc/ChangeLog:
PR c/81882
* doc/extend.texi (attribute ifunc): Avoid relying on ill-formed
code (in C++) or code that triggers warnings.
From-SVN: r253076
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/doc/extend.texi | 10 |
2 files changed, 12 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3071a86..baaafa7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-09-21 Martin Sebor <msebor@redhat.com> + + * PR c/81882 + * doc/extend.texi (attribute ifunc): Avoid relying on ill-formed + code (in C++) or code that triggers warnings. + 2017-09-21 Eric Botcazou <ebotcazou@adacore.com> * stor-layout.c (bit_from_pos): Do not distribute the conversion. diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index a66a795..3acba60 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -2783,21 +2783,23 @@ The @code{ifunc} attribute is used to mark a function as an indirect function using the STT_GNU_IFUNC symbol type extension to the ELF standard. This allows the resolution of the symbol value to be determined dynamically at load time, and an optimized version of the -routine can be selected for the particular processor or other system +routine to be selected for the particular processor or other system characteristics determined then. To use this attribute, first define the implementation functions available, and a resolver function that returns a pointer to the selected implementation function. The implementation functions' declarations must match the API of the -function being implemented, the resolver's declaration is be a -function returning pointer to void function returning void: +function being implemented. The resolver should be declared to +be a function taking no arguments and returning a pointer to +a function of the same type as the implementation. For example: @smallexample void *my_memcpy (void *dst, const void *src, size_t len) @{ @dots{} + return dst; @} -static void (*resolve_memcpy (void)) (void) +static void * (*resolve_memcpy (void))(void *, const void *, size_t) @{ return my_memcpy; // we'll just always select this routine @} |