Closed jkeenan closed 4 years ago
I get that here too, on my system it stems from this definition in /usr/include/x86_64-linux-gnu/sys/resource.h
:
/* The X/Open standard defines that all the functions below must use
`int' as the type for the first argument. When we are compiling with
GNU extensions we change this slightly to provide better error
checking. */
#if defined __USE_GNU && !defined __cplusplus
typedef enum __priority_which __priority_which_t;
#else
typedef int __priority_which_t;
#endif
So again the "XXX is invalid in C++" warning is irrelevant: were we compiling with C++, the headers would have declared the type as int
rather than as the enum.
I reckon this would be both difficult and useless to work around, I feel the answer is to turn off -Wc++-compat
and rely on real C++ builds to tell us if we really have real problems compiling under C++.
[update] Ah, the commit in question removed the work around we already had, and it really wasn't that difficult. However it is still useless.
Hugo
On Sun, 9 Feb 2020 at 18:07, Hugo van der Sanden notifications@github.com wrote:
I get that here too, on my system it stems from this definition in /usr/include/x86_64-linux-gnu/sys/resource.h:
/ The X/Open standard defines that all the functions below must use `int' as the type for the first argument. When we are compiling with GNU extensions we change this slightly to provide better error checking. /
if defined __USE_GNU && !defined __cplusplus
typedef enum __priority_which __priority_which_t;
else
typedef int __priority_which_t;
endif
So again the "XXX is invalid in C++" warning is irrelevant: were we compiling with C++, the headers would have declared the type as int rather than as the enum.
I reckon this would be both difficult and useless to work around, I feel the answer is to turn off -Wc++-compat and rely on real C++ builds to tell us if we really have real problems compiling under C++.
I saw it too. I ignored it because I think Ilmari is working on it, I saw some comments about it on #p5p irc.
From Feb 07:
(11:35:37) ilmari: argh, -Wc++-compat doesn't know that [gs]etpriority() doesn't have the first argument as an enum under c++ (11:36:01) ilmari: so it's fine with actual g++, but with gcc it warns :(
cheers, Yves
-- perl -Mre=debug -e "/just|another|perl|hacker/"
I think the best thing to do here is to revert my commit, and add a comment that explains the -Wc++compat
issue to the next person who comes along with a broom.
I'll do that shortly, unless someone else has a better idea.
I've now done that in commit 96d019622c8664693f6966a219cfdfd9c81ac025.
Confirming that the -Wc++-compat
warnings are gone. thanks.
Commit 34d254cefc4 on Feb 04 introduced new build-time warnings. Here are the new warnings found when running
make
on Linux, no threads, no debugging, etc.In more compact form:
@ilmari , can you take a look?
Thank you very much. Jim Keenan