This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: warnings in libiberty/testsuite/test-demangle.c


Ian Lance Taylor <ian@wasabisystems.com> writes:

> Andreas Jaeger <aj@suse.de> writes:
>
>> I just noticed the following warnings:
>> ../../../libiberty/testsuite/test-demangle.c: In function `main':
>> ../../../libiberty/testsuite/test-demangle.c:181: warning: implicit declaration
>> unction `strcspn'
>> ../../../libiberty/testsuite/test-demangle.c:184: warning: implicit declaration
>> unction `strcmp'
>> ../../../libiberty/testsuite/test-demangle.c:217: warning: implicit declaration
>> unction `strspn'
>> ../../../libiberty/testsuite/test-demangle.c:261: warning: implicit declaration
>> unction `free'
>> 
>> Ok to commit the appended patch?
>
> Sure, but the master repository for libiberty is gcc, so check it into
> the gcc repository, not the src repository.

Ok, will commit there - I'll copy gcc-patches with this patch
appended.

>> Btw. there's also this warning which seems to be true:
>> 
>> /cvs/binutils-ln/libiberty/testsuite/test-demangle.c: In function `main':
>> /cvs/binutils-ln/libiberty/testsuite/test-demangle.c:128: warning: `style' might be used uninitialized in this function
>
> Yes, I suppose we should check that it is set around the option
> processing loop.  A patch for that is OK to check in too.

We should do it upfront as default IMO.

Here's what I'm committing,
Andreas

2004-03-07  Andreas Jaeger  <aj@suse.de>

	* testsuite/test-demangle.c: Include <string.h> and <stdlib.h> for
	prototypes.
	(main): Initialize style.


============================================================
Index: libiberty/testsuite/test-demangle.c
--- testsuite/test-demangle.c	2 Jan 2004 20:33:55 -0000	1.4
+++ testsuite/test-demangle.c	7 Mar 2004 14:24:03 -0000
@@ -26,6 +26,12 @@
 #include <stdio.h>
 #include "libiberty.h"
 #include "demangle.h"
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
 
 struct line
 {
@@ -119,7 +125,7 @@ main(argc, argv)
      int argc;
      char **argv;
 {
-  enum demangling_styles style;
+  enum demangling_styles style = auto_demangling;
   int no_params;
   int is_v3_ctor;
   int is_v3_dtor;
-- 
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
  SuSE Linux AG, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]