Rename standards.h header file#8093
Rename standards.h header file#8093reshmavk wants to merge 1 commit intocppcheck-opensource:mainfrom
Conversation
|
|
Thanks for your contribution. For consistency, please rename |
I still do not understand how a system include can utilize a local include as those should be separated. That means that any project could "poison" the system ones. Seems like there is a bug in the compiler or the project is misconfigured. I also do not like the new name as naming something |
|
@reshmavk do you have a real AIX machine or do you use some cloud service that we could test? |
|
I use a real AIX machine, not from the cloud. standards.h The error occurs when compiled using |
|
@firewave I can reproduce something similar on my debian machine. I put two files in current folder 1.c and stddef.h. 1.c: stddef.h on my machine stdio.h includes stddef.h using angle brackets: my stddef.h in local folder gets included: If I remove the |
|
the first suggestion by chat gpt is to not reuse header filenames. but.. who says that it's only standards.h we can include using more specific paths i.e.: I don't have very great ideas right now. |
|
Can the option "-iquote" be utilised? Please let me know your thoughts on these changes |
basically your problem has nothing to do with AIX. and I therefore think its unfortunate to add special coding for AIX. There is a risk that somebody else will run into the same problem on another system. Or that your problem is solved on your system and then we will still have this code for no reason in our repo. I am not fundamentally against that we use |
|
I still do not understand how this can happen. We also have I really would prefer if we have a reproduction case - even if only locally. |
The example here: #8093 (comment) looks like what you need for reproduction, at least with gcc. The gcc documentation lays out how this behavior works: Section 3.17 Options for Directory Search Directories specified with -iquote apply only to the quote form of the directive, #include "file". Directories specified with -I, -isystem, or -idirafter apply to lookup for both the #include "file" and #include directives. You can specify any number or combination of these options on the command line to search for header files in several directories. The lookup order is as follows:
You can use -I to override a system header file, substituting your own version, since these directories are searched before the standard system header file directories. However, you should not use this option to add directories that contain vendor-supplied system header files; use -isystem for that. The problem manifests on AIX due to the fact it has a file named standards.h in the system include paths that doesn't get found in the system paths because any -I pointing into the cppcheck source will find the cppcheck version first. You'll either have to change header names or use some sort of trick like -iquote on AIX to fix this. |
|
Sorry for late reply. I don't like the options. If we rename settings.h then as firewave says we should probably sooner or later will need to rename config.h also. Another option is to put the headers in some other folder. all the headers could be moved into a cppcheck folder and then we could write "cppcheck/lib/settings.h" but this is a bigger change so I don't like it. Is it enough for now to change the includes to |



Compilation of cppcheck fails in AIX fails with multiple undeclared errors as shown below:
AIX has a system header file named standards.h which defines certain macros based on which types like int8_t,int16_t,etc are defined in stdint.h header file. Since cppcheck also has a header file named standards.h and this takes precedence over the system header file during compilation, system provided standards.h is not included resulting in the above mentioned errors. For more information please refer https://sourceforge.net/p/cppcheck/discussion/development/thread/b5b3f765b4/
To resolve this issue, this PR implements a possible solution: cppcheck provided standards.h has been renamed to cppcheckstd.h and
#include "standards.h"has been replaced with#include "cppcheckstd.h"wherever required in the source code.Could you please let me know if these changes are acceptable to merge or if there is a better approach to address this issue. I appreciate your suggestions.