|
Message-id: <A256987C-DE95-405D-9F26-3C54CC3B20A2@mac.com> Date: Fri, 28 Jul 2017 22:21:10 +1200 From: Michael Clark <michaeljclark@....com> To: musl@...ts.openwall.com Subject: stdbool.h does not define _Bool when included by C++ code Hi, I noticed an issue with the musl headers when installing compiler-explorer for RISC-V. Try compiling this code with g++ and musl's stdbool.h - https://cx.rv8.io/g/Bc3AwY <https://cx.rv8.io/> Compiler explorer uses the C++ front-end to the compiler by default It seems the musl stdbool.h defines bool in terms of _Bool for C, but does not define _Bool in terms of bool for C++. The gcc stdbool.h header handles both conditions and when included by C++ code it has #define _Bool bool but notes that it is a GNU extension. My workaround was to delete the musl stdbool.h so that the GCC version is included, but it seems the header could work for C code passed through the C++ front-end with a small patch (attached). The other musl headers seem to support C++, so I think it might be nice to fix stdbool.h for C code compiled through the C++ front-end. Of course C++ code needs casts on malloc and there are several other differences such as new reserved words, however for the most part, a lot of C code can compile using the C++ front-end. Michael Content of type "text/html" skipped Download attachment "musl-stdbool-cplusplus.patch" of type "application/octet-stream" (267 bytes) Content of type "text/html" skipped
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.