Fix code style - #1337
Conversation
a6f7c45 to
bc6f110
Compare
|
Commit b97ac54 introduced build errors in CI. The problem of that is a bit tricky. In the two files In other words, because of the way EDIT: There are two solutions.
|
inside the |
|
@fasterit Nope. That won't work. The The two "solutions" I mentioned above are the proper ways to do it. If it's me I would pick option 1, as |
|
Wtf. I'd favor your option 1 then, too. The lesser evil. Thank you very much for the analysis @Explorer09 ! /DLange |
|
@fasterit In addition I would propose to remove the #ifndef PACKAGE_NAME
#error "Must have #include \"config.h\" line at the top of the .c file, or else some XUtils.h functions might break."
#endifThe error message is self-explanatory. |
|
Seems to work for all but the PCP build... While it is included, of course. |
|
What a fitting kind of issue to have as PR 1337 … ;-) |
|
@fasterit The PCP failure comes from the brain-dead design of PCP that requires you to undefine |
edeb3d2 to
6ad1473
Compare
Many thanks to @Explorer09 Kang-Che Sung (宋岡哲). Also add a #error stanza to XUtils.h in case somebody forgets the beautiful mess GNU forces on us.
d164725 to
6cdefac
Compare
|
Didn't see any problems now with this PR. Just a final note. From the commit description:
It's not just GNU, but all feature test macros coming from POSIX and any of its extensions are required to be defined this way. This "feature" is kind of annoying for developing in the C language (unlike C++, which comes with namespaces to clean up the duplicated APIs and symbol name conflicts). I hate it too, but we have to live with it. Feature test macros was one of the reasons GNU autotools introduced |
78226f8 to
8d23657
Compare
I moved the includes of config.h from all header files (except |
Many thanks to @Explorer09 Kang-Che Sung (宋岡哲). Also add a #error stanza to XUtils.h in case somebody forgets the beautiful mess GNU forces on us.
This fixes an inconsistency between tests run by ./configure and actual make
This reduces the noise caused by incompatible attribute definitions between GCC/Clang.
e5ff991 to
01947da
Compare
Many thanks to @Explorer09 Kang-Che Sung (宋岡哲). Also add a #error stanza to XUtils.h in case somebody forgets the beautiful mess GNU forces on us.
|
@fasterit Just curious. Would the current And there are two .c files in htop that have the #undef PACKAGE_NAME
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#undef PACKAGE_STRING
#undef PACKAGE_BUGREPORT
#undef PACKAGE_URL
#include <pcp/pmapi.h>
#undef PACKAGE_NAME
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#undef PACKAGE_STRING
#undef PACKAGE_BUGREPORT
#undef PACKAGE_URL |
|
I think you want @natoscott for this @Explorer09. |
|
Technically they are no longer needed once the variables for the corresponding defines in |
|
@BenBE The default C macro names like AFAIK, there is no way for autoconf to not predefine these default (And just for the info, the C macros |
|
I wanted to know, what is the workaround for building PCP build? |
|
@AryanGitHub if you want to build pcp-htop you just need to install the devel package for your distribution which includes the header file mentioned there. |
Some code style updates …