[Bug c/81882] attribute ifunc documentation uses invalid code

2017-09-21 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81882

Martin Sebor  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=81854
 Resolution|--- |FIXED

--- Comment #4 from Martin Sebor  ---
Wording updated in r253076.

[Bug c/81882] attribute ifunc documentation uses invalid code

2017-09-21 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81882

--- Comment #3 from Martin Sebor  ---
Author: msebor
Date: Thu Sep 21 17:19:16 2017
New Revision: 253076

URL: https://gcc.gnu.org/viewcvs?rev=253076&root=gcc&view=rev
Log:
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.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/doc/extend.texi

[Bug c/81882] attribute ifunc documentation uses invalid code

2017-08-17 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81882

Martin Sebor  changed:

   What|Removed |Added

   Keywords||patch

--- Comment #2 from Martin Sebor  ---
Patch: https://gcc.gnu.org/ml/gcc-patches/2017-08/msg01090.html

[Bug c/81882] attribute ifunc documentation uses invalid code

2017-08-17 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81882

Martin Sebor  changed:

   What|Removed |Added

   Keywords||documentation
 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2017-08-17
   Assignee|unassigned at gcc dot gnu.org  |msebor at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Martin Sebor  ---
I believe the documentation should be changed like so:

Index: gcc/doc/extend.texi
===
--- gcc/doc/extend.texi (revision 251156)
+++ gcc/doc/extend.texi (working copy)
@@ -2783,21 +2783,24 @@ The @code{ifunc} attribute is used to mark a funct
 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 returning a pointer to 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
 @}