Skip to content

Commit f2740d9

Browse files
author
msebor
committed
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@253076 138bc75d-0d04-0410-961f-82ee72b054a4
1 parent 3dc558b commit f2740d9

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

gcc/ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2017-09-21 Martin Sebor <[email protected]>
2+
3+
* PR c/81882
4+
* doc/extend.texi (attribute ifunc): Avoid relying on ill-formed
5+
code (in C++) or code that triggers warnings.
6+
17
2017-09-21 Eric Botcazou <[email protected]>
28

39
* stor-layout.c (bit_from_pos): Do not distribute the conversion.

gcc/doc/extend.texi

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2783,21 +2783,23 @@ The @code{ifunc} attribute is used to mark a function as an indirect
27832783
function using the STT_GNU_IFUNC symbol type extension to the ELF
27842784
standard. This allows the resolution of the symbol value to be
27852785
determined dynamically at load time, and an optimized version of the
2786-
routine can be selected for the particular processor or other system
2786+
routine to be selected for the particular processor or other system
27872787
characteristics determined then. To use this attribute, first define
27882788
the implementation functions available, and a resolver function that
27892789
returns a pointer to the selected implementation function. The
27902790
implementation functions' declarations must match the API of the
2791-
function being implemented, the resolver's declaration is be a
2792-
function returning pointer to void function returning void:
2791+
function being implemented. The resolver should be declared to
2792+
be a function taking no arguments and returning a pointer to
2793+
a function of the same type as the implementation. For example:
27932794

27942795
@smallexample
27952796
void *my_memcpy (void *dst, const void *src, size_t len)
27962797
@{
27972798
@dots{}
2799+
return dst;
27982800
@}
27992801

2800-
static void (*resolve_memcpy (void)) (void)
2802+
static void * (*resolve_memcpy (void))(void *, const void *, size_t)
28012803
@{
28022804
return my_memcpy; // we'll just always select this routine
28032805
@}

0 commit comments

Comments
 (0)