Bug 41955
Summary: | /usr/include/rpm/rpmlib.h is not C++ safe | ||||||
---|---|---|---|---|---|---|---|
Product: | [Retired] Red Hat Raw Hide | Reporter: | Vladimir Kondratiev <vladimir.kondratiev> | ||||
Component: | rpm | Assignee: | Jeff Johnson <jbj> | ||||
Status: | CLOSED RAWHIDE | QA Contact: | David Lawrence <dkl> | ||||
Severity: | medium | Docs Contact: | |||||
Priority: | medium | ||||||
Version: | 1.0 | ||||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | All | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2001-05-23 13:22:52 UTC | Type: | --- | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Description
Vladimir Kondratiev
2001-05-23 11:07:28 UTC
Created attachment 19373 [details]
fix c++ compilation
Hmmm, this is C code, not C++ code, in rpmlib.h. And, the function is within a #ifdef __cplusplus extern "C" { #endif section. Yes, it may be unusual to have an entire static inline function within an include file <shrug>. While I'm not averse to changing the variable name "this", I think there's something else going on here that needs to be understood first.. What compiler are you using, and why is your C++ compiler getting picky about a C variable name that is clearly marked as a C function? Even if function is in 'extern "C"', it is still parsed by C++ compiler. extern "C" directive relates to linkage type only, it just dictates to not mangle function name. 'this' is still the reserved word. C++ standard say nothing about inline "C" functions, since this is extension, but assuming this should be handled similar to #define, it is obvious function code should be interpreted as C++ code when compiled by C++ compiler. It can't be the case that part of file compiled as C while the rest - ac C++. In my case, compiler is gcc as on rawhide (gcc-2.96-85). I use simple test case: ---------test.cpp-------- #include <rpmlib.h> void foo() {} ------------------------- If you try to compile it (gcc -I/usr/include/rpm -c test.cpp) you get errors mentioned. I checked that if I change 'this' to 'ptr' (as in patch attached), this simple test compiles fine. OK, so the static inline function is C++, not C. Thanks for the clarification. FIxed in next checkin, will be in rpm-4.0.3-0.26. |