Lint warning in v2.9.1

Discussion to talk about software related topics only.
Post Reply
SeeCwriter
Posts: 606
Joined: Mon May 12, 2008 10:55 am

Lint warning in v2.9.1

Post by SeeCwriter »

I also get this warning from lint for every file that includes stdlib.h:

c:\projects\nburn\O2/Packet.hpp 10 warning 451: header file 'stdlib.h'
repeatedly included but has no header guard
#include <stdlib.h>

I searched through the GCC include path and found 6 stdlib.h files. Everyone has a header guard except for one. I added a guard but it made no difference. I still get the warnings. Here are the first few lines of the file I modified:

Code: Select all

#if !defined __cplusplus || defined _GLIBCXX_INCLUDE_NEXT_C_HEADERS
#ifndef _STDLIB_H_    // added to remove warning
# include_next <stdlib.h>
#endif
#else

#ifndef _GLIBCXX_STDLIB_H
#define _GLIBCXX_STDLIB_H 1

# include <cstdlib> 
User avatar
pbreed
Posts: 1080
Joined: Thu Apr 24, 2008 3:58 pm

Re: Lint warning in v2.9.1

Post by pbreed »

I think the IF nesting in your fix is wrong.
SeeCwriter
Posts: 606
Joined: Mon May 12, 2008 10:55 am

Re: Lint warning in v2.9.1

Post by SeeCwriter »

How would you change it? Put the guard on the outside of the #if?
User avatar
pbreed
Posts: 1080
Joined: Thu Apr 24, 2008 3:58 pm

Re: Lint warning in v2.9.1

Post by pbreed »

I would put it as the very first line...

and very last line

I think its getting caught in the IF above it....

Have to admit the structiure of that include including sub parts is a bit strange...
Post Reply