Public bug reported:

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.

** Affects: mhash (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1465562

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mhash/+bug/1465562/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to