fix up msvc stuff to make it work on linux and macos too

This commit is contained in:
Andrew Kelley
2017-09-13 00:17:19 -04:00
parent 67021e2bff
commit 57ea6e8c9f
15 changed files with 299 additions and 222 deletions

View File

@@ -5194,8 +5194,7 @@ void codegen_add_object(CodeGen *g, Buf *object_path) {
g->link_objects.append(object_path);
}
#if defined(_MSVC)
// MSVC doesn't seem to support "designators" for array initialization
// Must be coordinated with with CIntType enum
static const char *c_int_type_names[] = {
"short",
"unsigned short",
@@ -5206,18 +5205,6 @@ static const char *c_int_type_names[] = {
"long long",
"unsigned long long",
};
#else
static const char *c_int_type_names[] = {
[CIntTypeShort] = "short",
[CIntTypeUShort] = "unsigned short",
[CIntTypeInt] = "int",
[CIntTypeUInt] = "unsigned int",
[CIntTypeLong] = "long",
[CIntTypeULong] = "unsigned long",
[CIntTypeLongLong] = "long long",
[CIntTypeULongLong] = "unsigned long long",
};
#endif
static void get_c_type(CodeGen *g, TypeTableEntry *type_entry, Buf *out_buf) {
assert(type_entry);