Page 1 of 1

Lint warning in v2.9.1

Posted: Tue Nov 05, 2019 9:05 am
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> 

Re: Lint warning in v2.9.1

Posted: Wed Nov 06, 2019 1:36 pm
by pbreed
I think the IF nesting in your fix is wrong.

Re: Lint warning in v2.9.1

Posted: Wed Nov 06, 2019 2:03 pm
by SeeCwriter
How would you change it? Put the guard on the outside of the #if?

Re: Lint warning in v2.9.1

Posted: Thu Nov 07, 2019 5:45 am
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...