Skip to content

Conversation

@reshmavk
Copy link
Contributor

@reshmavk reshmavk commented Jan 7, 2026

Compilation of cppcheck fails in AIX fails with multiple undeclared errors as shown below:

/opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/10/include/c++/cstdint:47:11: error: 'int8_t' has not been declared in '::'
   47 |   using ::int8_t;
      |           ^~~~~~
/opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/10/include/c++/cstdint:48:11: error: 'int16_t' has not been declared in '::'
   48 |   using ::int16_t;
      |           ^~~~~~~
/opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/10/include/c++/cstdint:49:11: error: 'int32_t' has not been declared in '::'
   49 |   using ::int32_t;
      |           ^~~~~~~
/opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/10/include/c++/cstdint:50:11: error: 'int64_t' has not been declared in '::'
   50 |   using ::int64_t;
      |           ^~~~~~~
/opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/10/include/c++/cstdint:52:11: error: 'int_fast8_t' has not been declared in '::'
   52 |   using ::int_fast8_t;
      |           ^~~~~~~~~~~
/opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/10/include/c++/cstdint:53:11: error: 'int_fast16_t' has not been declared in '::'

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.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 7, 2026

@chrchr-github
Copy link
Collaborator

Thanks for your contribution. For consistency, please rename standards.cpp to cppcheckstd.cpp.
You also need to replace all references to standards.h in Makefile and in https://github.com/reshmavk/cppcheck/blob/rename_standards/tools/dmake/dmake.cpp

@firewave
Copy link
Collaborator

firewave commented Jan 8, 2026

In file included from /home/buildusr/reshma/patch_contribution/cppcheck/lib/standards.h:24,
                 from /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/10/include-fixed/wchar.h:44,
                 from /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/10/include/c++/cwchar:44,
                 from /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/10/include/c++/bits/postypes.h:40,
                 from /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/10/include/c++/bits/char_traits.h:40,
                 from /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/10/include/c++/string:40,
                 from /home/buildusr/reshma/patch_contribution/cppcheck/lib/matchcompiler.h:23,
                 from /home/buildusr/reshma/patch_contribution/cppcheck/build/lib/build/mc_valueflow.cpp:1:
/home/buildusr/reshma/patch_contribution/cppcheck/lib/config.h:137:26: error: aggregate 'const string emptyString' has incomplete type and cannot be defined
  137 | static const std::string emptyString;
      |                          ^~~~~~~~~~~

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 cppcheck*.* is redundant and does not reflect the contents.

@danmar
Copy link
Owner

danmar commented Jan 8, 2026

@reshmavk do you have a real AIX machine or do you use some cloud service that we could test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants