psmedley / gcc

GNU General Public License v2.0
7 stars 1 forks source link

Missing builtin macros #13

Closed komh closed 8 years ago

komh commented 9 years ago

Hi/2.

gcc-os2-492 misses some builtin macros.

Here are the builtin macros of gcc-mingw-491.

#define __UINT_LEAST8_TYPE__ unsigned char
#define __SIG_ATOMIC_TYPE__ int
#define __UINTMAX_TYPE__ long long unsigned int
#define __INT_FAST16_TYPE__ short int
#define __INT_FAST64_TYPE__ long long int
#define __UINT8_TYPE__ unsigned char
#define __INT_FAST32_TYPE__ int
#define __UINT_LEAST16_TYPE__ short unsigned int
#define __SIZE_TYPE__ unsigned int
#define __INT8_TYPE__ signed char
#define __INT_LEAST16_TYPE__ short int
#define __UINT_LEAST64_TYPE__ long long unsigned int
#define __UINT_FAST16_TYPE__ short unsigned int
#define __CHAR16_TYPE__ short unsigned int
#define __INT_LEAST64_TYPE__ long long int
#define __INT16_TYPE__ short int
#define __INT_LEAST8_TYPE__ signed char
#define __INTPTR_TYPE__ int
#define __UINT16_TYPE__ short unsigned int
#define __WCHAR_TYPE__ short unsigned int
#define __UINT_FAST64_TYPE__ long long unsigned int
#define __INT64_TYPE__ long long int
#define __WINT_TYPE__ short unsigned int
#define __UINT_LEAST32_TYPE__ unsigned int
#define __INT_LEAST32_TYPE__ int
#define __UINT64_TYPE__ long long unsigned int
#define __INT_FAST8_TYPE__ signed char
#define __UINT_FAST32_TYPE__ unsigned int
#define __CHAR32_TYPE__ unsigned int
#define __INT32_TYPE__ int
#define __INTMAX_TYPE__ long long int
#define __PTRDIFF_TYPE__ int
#define __UINT32_TYPE__ unsigned int
#define __UINTPTR_TYPE__ unsigned int
#define __UINT_FAST8_TYPE__ unsigned char

However, gcc-os2-492

#define __UINTMAX_TYPE__ long long unsigned int
#define __SIZE_TYPE__ unsigned int
#define __CHAR16_TYPE__ short unsigned int
#define __WCHAR_TYPE__ short unsigned int
#define __WINT_TYPE__ unsigned int
#define __CHAR32_TYPE__ unsigned int
#define __INTMAX_TYPE__ long long int
#define __PTRDIFF_TYPE__ int

You can get these macros with this,

g++ -E -dM - < nul | grep _TYPE__
komh commented 9 years ago

Here is the patch.

From 45a2b913c83207a4cc15dc3fe8c96eaefd608259 Mon Sep 17 00:00:00 2001
From: KO Myung-Hun <komh@chollian.net>
Date: Mon, 29 Jun 2015 16:54:20 +0900
Subject: [PATCH 1/3] OS/2: add missed built-in integer macros

---
 gcc/config.gcc               |  1 +
 gcc/config/i386/emx-stdint.h | 50 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+)
 create mode 100644 gcc/config/i386/emx-stdint.h

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 83b9bc9..2ba7613 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1702,6 +1702,7 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
 i*86-pc-*emx)      # i?86 running OS/2
    xm_file=i386/xm-emx.h
    tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/gstabs.h i386/emx.h"
+   tm_file="${tm_file} i386/emx-stdint.h"
    extra_objs="emx.o emx-stubs.o"
    extra_gcc_objs="emx-driver.o"
    extra_options="${extra_options} i386/emx.opt"
diff --git a/gcc/config/i386/emx-stdint.h b/gcc/config/i386/emx-stdint.h
new file mode 100644
index 0000000..bed703c
--- /dev/null
+++ b/gcc/config/i386/emx-stdint.h
@@ -0,0 +1,50 @@
+/* Definitions for <stdint.h> types on systems using emx/kLIBC.
+   Copyright (C) 2009-2015 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+#define SIG_ATOMIC_TYPE "int"
+
+#define INT8_TYPE "signed char"
+#define INT16_TYPE "short int"
+#define INT32_TYPE "int"
+#define INT64_TYPE "long long int"
+#define UINT8_TYPE "unsigned char"
+#define UINT16_TYPE "short unsigned int"
+#define UINT32_TYPE "unsigned int"
+#define UINT64_TYPE "long long unsigned int"
+
+#define INT_LEAST8_TYPE "signed char"
+#define INT_LEAST16_TYPE "short int"
+#define INT_LEAST32_TYPE "int"
+#define INT_LEAST64_TYPE "long long int"
+#define UINT_LEAST8_TYPE "unsigned char"
+#define UINT_LEAST16_TYPE "short unsigned int"
+#define UINT_LEAST32_TYPE "unsigned int"
+#define UINT_LEAST64_TYPE "long long unsigned int"
+
+#define INT_FAST8_TYPE "signed char"
+#define INT_FAST16_TYPE "short int"
+#define INT_FAST32_TYPE "int"
+#define INT_FAST64_TYPE "long long int"
+#define UINT_FAST8_TYPE "unsigned char"
+#define UINT_FAST16_TYPE "short unsigned int"
+#define UINT_FAST32_TYPE "unsigned int"
+#define UINT_FAST64_TYPE "long long unsigned int"
+
+#define INTPTR_TYPE "int"
+#define UINTPTR_TYPE "unsigned int"
-- 
1.9.5
psmedley commented 9 years ago

I have added this patch for my local build of GCC 5.2.0

komh commented 8 years ago

Pushed as commit ff0cf594424d7a5e23ccd178a2f8ee87f84d40d4.

dmik commented 8 years ago

Thanks.