Subject: Anonymous enum errors + fix and question about


Attempting to recompile cryptoPP lead my shiny new gcc v. 4.0.1 to gag
in a number of places with annoying

"foo.cpp:NN: error: 'Bar::<anonymous enum>' is/uses anonymous type"


This happens with CryptoPP 5.2.1 as well as the CVS version of the c5
module I just checked out.

A quick fix you can run on the command line (in unix-like environments)
from within the source directory is:

$ for i in `grep -l 'enum {' *.h | sed -e 's/\.h//g'` ; \
do \
perl -pi -e \
"s/enum {/'enum en_$i' . int(rand(100)) .' {'/eg" $i.h; \

which replaces all the anonymous enums in file XYZ.h with
enum en_XYZNN {
where NN is a random number, eg "enum en_zdeflate34 {" in zdeflate.h.

This fixes compilation issues, up to getting a workable libcryptopp.a
that is (now it dies somewhere compiling dlltest.cpp with
"dlltest.cpp:198: error: expected constructor, destructor, or type
conversion before ‘(’ token" errors).

Also, I usually like to compile everything so it warns on everything and
treats warnings as errors (-Werror) but this is impossible right now
because I get a lot of

/path/to/cryptlib.h:352: warning: ‘class
CryptoPP::SimpleKeyingInterface’ has virtual functions but non-virtual

/path/to/cryptlib.h:663: warning: ‘class CryptoPP::Waitable’ has virtual
functions but non-virtual destructor

I thought to add some quick

virtual ~Waitable() {}

destructors but noticed that the class defs included

class CRYPTOPP_NO_VTABLE Waitable { ... }

Seems under Linux this is just defined empty but I'm wondering why it's
there and whether adding my virtual destructors will have any negative

Any hints?

Pat Deegan,
PGP: 0x32CBD168

Programming list archiving by: Enterprise Git Hosting