mhash.h fails to compile with clang++ -std=c++14

Bug #1465562 reported by Ingo Ruhnke on 2015-06-16
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mhash (Ubuntu)
Undecided
Unassigned

Bug Description

mhash.h fails to compile with clang++ when -std=c++14 or any of the other c++ standards is enabled. The problem is that mhash uses _Bool, but clang only defines _Bool in C mode, not in C++ mode:

/usr/lib/llvm-3.5/lib/clang/3.5.2/include/stdbool.h

Fixing the problem can be done by replacing '_Bool' with 'bool' in:

/usr/include/mutils/mutils.h

As far as I understand it using _Bool directly is not advised:

http://stackoverflow.com/a/4767954/28113

Example of the problem:

$ cat main.cpp
#include <mhash.h>
int main() {}

$ clang++ main.cpp $(pkg-config --cflags --libs mhash) -std=c++14
In file included from main.cpp:1:
In file included from /usr/include/mhash.h:8:
In file included from /usr/include/mutils/mtypes.h:24:
/usr/include/mutils/mutils.h:250:70: error: unknown type name '_Bool'
mutils_word32 *mutils_word32nswap(mutils_word32 *x, mutils_word32 n, mutils_boolean destructive);
                                                                     ^
/usr/include/mutils/mutils.h:100:24: note: expanded from macro 'mutils_boolean'
#define mutils_boolean _Bool
                       ^
/usr/include/mutils/mutils.h:253:1: error: unknown type name '_Bool'
mutils_boolean mutils_thequals(mutils_word8 *text, mutils_word8 *hash, __const mutils_word32 len);
^
/usr/include/mutils/mutils.h:100:24: note: expanded from macro 'mutils_boolean'
#define mutils_boolean _Bool
                       ^
In file included from main.cpp:1:
In file included from /usr/include/mhash.h:10:
/usr/include/mutils/mhash.h:73:1: error: unknown type name '_Bool'
mutils_boolean mhash(MHASH thread, const void *plaintext, mutils_word32 size);
^
/usr/include/mutils/mutils.h:100:24: note: expanded from macro 'mutils_boolean'
#define mutils_boolean _Bool
                       ^
In file included from main.cpp:1:
In file included from /usr/include/mhash.h:10:
/usr/include/mutils/mhash.h:91:1: error: unknown type name '_Bool'
mutils_boolean mhash_hmac_deinit(MHASH thread, void *result);
^
/usr/include/mutils/mutils.h:100:24: note: expanded from macro 'mutils_boolean'
#define mutils_boolean _Bool
                       ^
In file included from main.cpp:1:
In file included from /usr/include/mhash.h:10:
/usr/include/mutils/mhash.h:95:1: error: unknown type name '_Bool'
mutils_boolean mhash_save_state_mem(MHASH thread, void *mem, mutils_word32 *mem_size);
^
/usr/include/mutils/mutils.h:100:24: note: expanded from macro 'mutils_boolean'
#define mutils_boolean _Bool
                       ^
In file included from main.cpp:1:
In file included from /usr/include/mhash.h:10:
/usr/include/mutils/mhash.h:116:1: error: unknown type name '_Bool'
mutils_boolean mhash_keygen_uses_salt(keygenid type);
^
/usr/include/mutils/mutils.h:100:24: note: expanded from macro 'mutils_boolean'
#define mutils_boolean _Bool
                       ^
In file included from main.cpp:1:
In file included from /usr/include/mhash.h:10:
/usr/include/mutils/mhash.h:117:1: error: unknown type name '_Bool'
mutils_boolean mhash_keygen_uses_count(keygenid type);
^
/usr/include/mutils/mutils.h:100:24: note: expanded from macro 'mutils_boolean'
#define mutils_boolean _Bool
                       ^
In file included from main.cpp:1:
In file included from /usr/include/mhash.h:10:
/usr/include/mutils/mhash.h:118:1: error: unknown type name '_Bool'
mutils_boolean mhash_keygen_uses_hash_algorithm(keygenid type);
^
/usr/include/mutils/mutils.h:100:24: note: expanded from macro 'mutils_boolean'
#define mutils_boolean _Bool
                       ^
8 errors generated.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers