<div dir="ltr">We will always use 'unsigned char' with MSVC.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Oct 24, 2013 at 5:16 PM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I missed the last bits of the discussion on IRC. So the idea is that<br>
we will always use int with msvc or we don't care as much about ABI<br>
compatibility on windows (yet)?<br>
<div class="HOEnZb"><div class="h5"><br>
On 24 October 2013 18:26, Reid Kleckner <<a href="mailto:reid@kleckner.net">reid@kleckner.net</a>> wrote:<br>
> Author: rnk<br>
> Date: Thu Oct 24 17:26:04 2013<br>
> New Revision: 193377<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=193377&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=193377&view=rev</a><br>
> Log:<br>
> lto.h: Use lto_bool_t instead of int to restore the ABI<br>
><br>
> This reverts commit r193255 and instead creates an lto_bool_t typedef<br>
> that points to bool, _Bool, or unsigned char depending on what is<br>
> available.  Only recent versions of MSVC provide a stdbool.h header.<br>
><br>
> Reviewers: rafael.espindola<br>
><br>
> Differential Revision: <a href="http://llvm-reviews.chandlerc.com/D2019" target="_blank">http://llvm-reviews.chandlerc.com/D2019</a><br>
><br>
> Modified:<br>
>     llvm/trunk/include/llvm-c/lto.h<br>
>     llvm/trunk/tools/lto/lto.cpp<br>
><br>
> Modified: llvm/trunk/include/llvm-c/lto.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/lto.h?rev=193377&r1=193376&r2=193377&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/lto.h?rev=193377&r1=193376&r2=193377&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/include/llvm-c/lto.h (original)<br>
> +++ llvm/trunk/include/llvm-c/lto.h Thu Oct 24 17:26:04 2013<br>
> @@ -19,6 +19,20 @@<br>
>  #include <stddef.h><br>
>  #include <sys/types.h><br>
><br>
> +#ifndef __cplusplus<br>
> +#if !defined(_MSC_VER)<br>
> +#include <stdbool.h><br>
> +typedef bool lto_bool_t;<br>
> +#else<br>
> +// MSVC in particular does not have anything like _Bool or bool in C, but we can<br>
> +// at least make sure the type is the same size.  The implementation side will<br>
> +// use C++ bool.<br>
> +typedef unsigned char lto_bool_t;<br>
> +#endif<br>
> +#else<br>
> +typedef bool lto_bool_t;<br>
> +#endif<br>
> +<br>
>  /**<br>
>   * @defgroup LLVMCLTO LTO<br>
>   * @ingroup LLVMC<br>
> @@ -86,14 +100,14 @@ lto_get_error_message(void);<br>
>  /**<br>
>   * Checks if a file is a loadable object file.<br>
>   */<br>
> -extern int<br>
> +extern lto_bool_t<br>
>  lto_module_is_object_file(const char* path);<br>
><br>
><br>
>  /**<br>
>   * Checks if a file is a loadable object compiled for requested target.<br>
>   */<br>
> -extern int<br>
> +extern lto_bool_t<br>
>  lto_module_is_object_file_for_target(const char* path,<br>
>                                       const char* target_triple_prefix);<br>
><br>
> @@ -101,14 +115,14 @@ lto_module_is_object_file_for_target(con<br>
>  /**<br>
>   * Checks if a buffer is a loadable object file.<br>
>   */<br>
> -extern int<br>
> +extern lto_bool_t<br>
>  lto_module_is_object_file_in_memory(const void* mem, size_t length);<br>
><br>
><br>
>  /**<br>
>   * Checks if a buffer is a loadable object compiled for requested target.<br>
>   */<br>
> -extern int<br>
> +extern lto_bool_t<br>
>  lto_module_is_object_file_in_memory_for_target(const void* mem, size_t length,<br>
>                                                const char* target_triple_prefix);<br>
><br>
> @@ -207,7 +221,7 @@ lto_codegen_dispose(lto_code_gen_t);<br>
>   * Add an object module to the set of modules for which code will be generated.<br>
>   * Returns true on error (check lto_get_error_message() for details).<br>
>   */<br>
> -extern int<br>
> +extern lto_bool_t<br>
>  lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod);<br>
><br>
><br>
> @@ -216,7 +230,7 @@ lto_codegen_add_module(lto_code_gen_t cg<br>
>   * Sets if debug info should be generated.<br>
>   * Returns true on error (check lto_get_error_message() for details).<br>
>   */<br>
> -extern int<br>
> +extern lto_bool_t<br>
>  lto_codegen_set_debug_model(lto_code_gen_t cg, lto_debug_model);<br>
><br>
><br>
> @@ -224,7 +238,7 @@ lto_codegen_set_debug_model(lto_code_gen<br>
>   * Sets which PIC code model to generated.<br>
>   * Returns true on error (check lto_get_error_message() for details).<br>
>   */<br>
> -extern int<br>
> +extern lto_bool_t<br>
>  lto_codegen_set_pic_model(lto_code_gen_t cg, lto_codegen_model);<br>
><br>
><br>
> @@ -270,7 +284,7 @@ extern void lto_codegen_add_dso_symbol(l<br>
>   * merged contents of all modules added so far.<br>
>   * Returns true on error (check lto_get_error_message() for details).<br>
>   */<br>
> -extern int<br>
> +extern lto_bool_t<br>
>  lto_codegen_write_merged_modules(lto_code_gen_t cg, const char* path);<br>
><br>
>  /**<br>
> @@ -288,7 +302,7 @@ lto_codegen_compile(lto_code_gen_t cg, s<br>
>   * Generates code for all added modules into one native object file.<br>
>   * The name of the file is written to name. Returns true on error.<br>
>   */<br>
> -extern int<br>
> +extern lto_bool_t<br>
>  lto_codegen_compile_to_file(lto_code_gen_t cg, const char** name);<br>
><br>
><br>
><br>
> Modified: llvm/trunk/tools/lto/lto.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/lto.cpp?rev=193377&r1=193376&r2=193377&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/lto.cpp?rev=193377&r1=193376&r2=193377&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/tools/lto/lto.cpp (original)<br>
> +++ llvm/trunk/tools/lto/lto.cpp Thu Oct 24 17:26:04 2013<br>
> @@ -90,26 +90,26 @@ const char* lto_get_error_message() {<br>
>  }<br>
><br>
>  /// lto_module_is_object_file - Validates if a file is a loadable object file.<br>
> -int lto_module_is_object_file(const char* path) {<br>
> +bool lto_module_is_object_file(const char* path) {<br>
>    return LTOModule::isBitcodeFile(path);<br>
>  }<br>
><br>
>  /// lto_module_is_object_file_for_target - Validates if a file is a loadable<br>
>  /// object file compilable for requested target.<br>
> -int lto_module_is_object_file_for_target(const char* path,<br>
> +bool lto_module_is_object_file_for_target(const char* path,<br>
>                                            const char* target_triplet_prefix) {<br>
>    return LTOModule::isBitcodeFileForTarget(path, target_triplet_prefix);<br>
>  }<br>
><br>
>  /// lto_module_is_object_file_in_memory - Validates if a buffer is a loadable<br>
>  /// object file.<br>
> -int lto_module_is_object_file_in_memory(const void* mem, size_t length) {<br>
> +bool lto_module_is_object_file_in_memory(const void* mem, size_t length) {<br>
>    return LTOModule::isBitcodeFile(mem, length);<br>
>  }<br>
><br>
>  /// lto_module_is_object_file_in_memory_for_target - Validates if a buffer is a<br>
>  /// loadable object file compilable for the target.<br>
> -int<br>
> +bool<br>
>  lto_module_is_object_file_in_memory_for_target(const void* mem,<br>
>                                              size_t length,<br>
>                                              const char* target_triplet_prefix) {<br>
> @@ -216,21 +216,21 @@ void lto_codegen_dispose(lto_code_gen_t<br>
>  /// lto_codegen_add_module - Add an object module to the set of modules for<br>
>  /// which code will be generated. Returns true on error (check<br>
>  /// lto_get_error_message() for details).<br>
> -int lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod) {<br>
> +bool lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod) {<br>
>    return !cg->addModule(mod, sLastErrorString);<br>
>  }<br>
><br>
>  /// lto_codegen_set_debug_model - Sets what if any format of debug info should<br>
>  /// be generated. Returns true on error (check lto_get_error_message() for<br>
>  /// details).<br>
> -int lto_codegen_set_debug_model(lto_code_gen_t cg, lto_debug_model debug) {<br>
> +bool lto_codegen_set_debug_model(lto_code_gen_t cg, lto_debug_model debug) {<br>
>    cg->setDebugInfo(debug);<br>
>    return false;<br>
>  }<br>
><br>
>  /// lto_codegen_set_pic_model - Sets what code model to generated. Returns true<br>
>  /// on error (check lto_get_error_message() for details).<br>
> -int lto_codegen_set_pic_model(lto_code_gen_t cg, lto_codegen_model model) {<br>
> +bool lto_codegen_set_pic_model(lto_code_gen_t cg, lto_codegen_model model) {<br>
>    cg->setCodePICModel(model);<br>
>    return false;<br>
>  }<br>
> @@ -267,7 +267,7 @@ void lto_codegen_add_dso_symbol(lto_code<br>
>  /// lto_codegen_write_merged_modules - Writes a new file at the specified path<br>
>  /// that contains the merged contents of all modules added so far. Returns true<br>
>  /// on error (check lto_get_error_message() for details).<br>
> -int lto_codegen_write_merged_modules(lto_code_gen_t cg, const char *path) {<br>
> +bool lto_codegen_write_merged_modules(lto_code_gen_t cg, const char *path) {<br>
>    if (!parsedOptions) {<br>
>      cg->parseCodeGenDebugOptions();<br>
>      parsedOptions = true;<br>
> @@ -293,7 +293,7 @@ const void *lto_codegen_compile(lto_code<br>
>  /// lto_codegen_compile_to_file - Generates code for all added modules into one<br>
>  /// native object file. The name of the file is written to name. Returns true on<br>
>  /// error.<br>
> -int lto_codegen_compile_to_file(lto_code_gen_t cg, const char **name) {<br>
> +bool lto_codegen_compile_to_file(lto_code_gen_t cg, const char **name) {<br>
>    if (!parsedOptions) {<br>
>      cg->parseCodeGenDebugOptions();<br>
>      parsedOptions = true;<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>