[Bug c/43666] New: Add optional message to the deprecated attribute

2010-04-06 Thread ebassi at gmail dot com
it would improve the error reporting output for deprecated types, variables and
functions if it could be possible to define the deprecated attribute with an
optional message, e.g.:

  int f1 (void) __attribute__ ((deprecated ("Use f2() instead")));
  int f2 (void);

which would print:

  warning: ‘f1’ is deprecated: Use f2() instead


-- 
   Summary: Add optional message to the deprecated attribute
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ebassi at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43666



[Bug c/43666] Add optional message to the deprecated attribute

2010-04-06 Thread ebassi at gmail dot com


--- Comment #2 from ebassi at gmail dot com  2010-04-06 14:36 ---
sweet, thanks.

just FYI, I tested it using:

  $ cat test-deprecated.c
  #include 

  int foo (void) __attribute__((deprecated("Use bar() instead")));
  int bar (void);

  int main (int argc, char *argv[])
  {
printf ("foo: %d\n", foo ());
printf ("bar: %d\n", bar ());

return 0;
  }

  int foo (void) { return 42; }
  int bar (void) { return 47; }

  $ gcc -Wall -o test-deprecated test-deprecated.c
  test-deprecated.c:3: error: wrong number of arguments specified for
‘deprecated’ attribute

my gcc is:

  $ gcc --version
  gcc (GCC) 4.4.3 20100127 (Red Hat 4.4.3-4)

thanks again for the quick reply. :-)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43666