aalogparse.h cannot be included from C++ code

Bug #2004592 reported by Steve Langasek
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apparmor (Ubuntu)
New
Wishlist
Unassigned

Bug Description

aalogparse.h cannot be included from C++ code because it uses 'namespace' and 'class' as variable names, and these are reserved keywords in C++.

/usr/include/aalogparse/aalogparse.h:137:15: error: expected unqualified-id before ‘namespace’
  137 | char *namespace;
      | ^~~~~~~~~
/usr/include/aalogparse/aalogparse.h:163:15: error: expected unqualified-id before ‘class’
  163 | char *class;
      | ^~~~~

This is interesting to me because abi-compliance-checker necessarily processes all headers as C++; but it's likely of general interest to be able to link C++ code to libapparmor.

Revision history for this message
John Johansen (jjohansen) wrote :

Sigh, so this one is a bit of a pita. Minimal C code uses this and it is easy to update that. The problem comes with the SWIG interface libraries (python, ruby, etc) have baked these names into their API. We can update those but then we stand a good chance of breaking some external code.

Admittedly I don't know SWIG well, but I am looking into what can be done.

Revision history for this message
Steve Langasek (vorlon) wrote :

FWIW this is less interesting to me personally now, as I found the right switches to abi-compliance-checker to deal with C++ keywords as C variable names. And also it turns out there are a lot of C headers that have this problem. So while it's probably still interesting to someone to be able to use these headers from C++ code, that someone is no longer me :)

Changed in apparmor (Ubuntu):
importance: Undecided → Wishlist
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.