[Bug c/26386] New: strdup "implicit declaration" warning when using -ansi

2006-02-20 Thread parcour at gmail dot com
ute__
((__nonnull__ (1, 2)));

extern char *strstr (__const char *__haystack, __const char *__needle)
 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__
((__nonnull__ (1, 2)));



extern char *strtok (char *__restrict __s, __const char *__restrict __delim)
 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));




extern char *__strtok_r (char *__restrict __s,
__const char *__restrict __delim,
char **__restrict __save_ptr)
 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 3)));
# 240 "/usr/include/string.h" 3 4


extern size_t strlen (__const char *__s)
 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__
((__nonnull__ (1)));

# 254 "/usr/include/string.h" 3 4


extern char *strerror (int __errnum) __attribute__ ((__nothrow__));

# 288 "/usr/include/string.h" 3 4
extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__))
__attribute__ ((__nonnull__ (1)));
# 426 "/usr/include/string.h" 3 4

# 2 "test.c" 2
# 1 "/usr/include/malloc.h" 1 3 4
# 24 "/usr/include/malloc.h" 3 4
# 1 "/usr/lib/gcc/i386-redhat-linux/4.0.2/include/stddef.h" 1 3 4
# 152 "/usr/lib/gcc/i386-redhat-linux/4.0.2/include/stddef.h" 3 4
typedef int ptrdiff_t;
# 326 "/usr/lib/gcc/i386-redhat-linux/4.0.2/include/stddef.h" 3 4
typedef long int wchar_t;
# 25 "/usr/include/malloc.h" 2 3 4
# 46 "/usr/include/malloc.h" 3 4



extern void *malloc (size_t __size) __attribute__ ((__nothrow__)) __attribute__
((__malloc__)) ;


extern void *calloc (size_t __nmemb, size_t __size) __attribute__
((__nothrow__))
   __attribute__ ((__malloc__)) ;



extern void *realloc (void *__ptr, size_t __size) __attribute__ ((__nothrow__))
   __attribute__ ((__malloc__)) __attribute__ ((__warn_unused_result__));


extern void free (void *__ptr) __attribute__ ((__nothrow__));


extern void cfree (void *__ptr) __attribute__ ((__nothrow__));


extern void *memalign (size_t __alignment, size_t __size) __attribute__
((__nothrow__))
   __attribute__ ((__malloc__)) ;


extern void *valloc (size_t __size) __attribute__ ((__nothrow__))
   __attribute__ ((__malloc__)) ;



extern void * pvalloc (size_t __size) __attribute__ ((__nothrow__))
   __attribute__ ((__malloc__)) ;



extern void *(*__morecore) (ptrdiff_t __size);


extern void *__default_morecore (ptrdiff_t __size) __attribute__
((__nothrow__))
   __attribute__ ((__malloc__));



struct mallinfo {
  int arena;
  int ordblks;
  int smblks;
  int hblks;
  int hblkhd;
  int usmblks;
  int fsmblks;
  int uordblks;
  int fordblks;
  int keepcost;
};


extern struct mallinfo mallinfo (void) __attribute__ ((__nothrow__));
# 128 "/usr/include/malloc.h" 3 4
extern int mallopt (int __param, int __val) __attribute__ ((__nothrow__));



extern int malloc_trim (size_t __pad) __attribute__ ((__nothrow__));



extern size_t malloc_usable_size (void *__ptr) __attribute__ ((__nothrow__));


extern void malloc_stats (void) __attribute__ ((__nothrow__));


extern void *malloc_get_state (void) __attribute__ ((__nothrow__));



extern int malloc_set_state (void *__ptr) __attribute__ ((__nothrow__));




extern void (*__malloc_initialize_hook) (void);

extern void (*__free_hook) (void *__ptr, __const void *);

extern void *(*__malloc_hook) (size_t __size, __const void *);

extern void *(*__realloc_hook) (void *__ptr, size_t __size, __const void *);

extern void *(*__memalign_hook) (size_t __alignment, size_t __size, __const
void *);


extern void (*__after_morecore_hook) (void);


extern void __malloc_check_init (void) __attribute__ ((__nothrow__));



# 3 "test.c" 2

int main()
{
char *s = strdup( "foo" );
free( s );
return 0;
}


-- 
   Summary: strdup "implicit declaration" warning when using -ansi
   Product: gcc
   Version: 4.0.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: parcour at gmail dot com


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



[Bug c/26386] strdup "implicit declaration" warning when using -ansi

2006-02-20 Thread parcour at gmail dot com


--- Comment #3 from parcour at gmail dot com  2006-02-20 22:04 ---
Subject: Re:  strdup "implicit declaration" warning when using -ansi

I see.  Sorry for a needless bug report.  But thank you for your
helpful responses.  I expect
I really will need to use -ansi (--> STRICT_ANSI), so I'll have to do
without strdup.

Joshua Shinavier


On 20 Feb 2006 20:07:13 -, pinskia at gcc dot gnu dot org
<[EMAIL PROTECTED]> wrote:
>
>
> --- Comment #2 from pinskia at gcc dot gnu dot org  2006-02-20 20:07 
> ---
> Ok, either use -D_GNU_SOURCE or don't use -ansi.  Use -pedantic-errors instead
> of -ansi.
>
>
> --
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26386
>
> --- You are receiving this mail because: ---
> You reported the bug, or are watching the reporter.
>


-- 


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