[apparmor] [patch} parser: convert array into unordered map (was Re: [Branch ~apparmor-dev/apparmor/master] Rev 2193: Convert the parser to C++)
Steve Beattie
steve at nxnw.org
Tue Nov 19 00:29:40 UTC 2013
On Mon, Nov 18, 2013 at 11:48:58AM -0800, Seth Arnold wrote:
> On Sat, Nov 16, 2013 at 11:59:03PM -0800, Steve Beattie wrote:
> > That said, I think continuing to support g++ 4.6 is important, given
> > it's the compiler version in Ubuntu 12.04 LTS (aka precise). So here
> > is a patch that converts the problematic array definition into a C++
> > unordered_map type. Using this depends on using the c++0x (aka c++11)
> > standard, and as we have gnuisms elsewhere (using the typeof builtin),
> > the patch also adds/converts to using -std=gnu++c0x in the build
> > rules (which conveniently eliminates some other warnings we had due
> > to other c++11-isms).
>
> Very nice. I certainly don't mind using gnuisms, compiling on a platform
> where clang is the compiler of choice seems unlikely for many reasons.
Aww, shoot, that reminded me that I should try to look for errors with
scan-build (http://clang-analyzer.llvm.org/scan-build.html). Yes, as
expected, it fails due to the -std=gnu++0x option here.
> > -#define PDEBUG(fmt, args...) printf("Lexer (Line %d) (state %s): " fmt, current_lineno, state_names[YY_START], ## args)
> > +#define PDEBUG(fmt, args...) printf("Lexer (Line %d) (state %s): " fmt, current_lineno, state_names[YY_START].c_str(), ## args)
>
> In time we should probably migrate these to:
>
> cout << "Lexer (Line " << current_lineno << ") (state " << state_names[YY_START] << "): << ...
>
> But there's no need to hold up this patch now for that trasition.
Yep, there's a lot of work left to move the codebase over to more
stylistically pure C++.
--
Steve Beattie
<sbeattie at ubuntu.com>
http://NxNW.org/~steve/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20131118/cdb1158d/attachment.pgp>
More information about the AppArmor
mailing list