Browse Source

Merge ATTRIBUTE_MAY_ALIAS patches from dasm-tigcc.

git-svn-id: file:///var/svn/tigccpp/trunk/tigcc/ld-tigcc@1154 9552661e-59e3-4036-b4f2-dbe53926924f
kevinkofler 17 years ago
parent
commit
eef8b6dbaf
2 changed files with 20 additions and 6 deletions
  1. 7 0
      generic.h
  2. 13 6
      integers.h

+ 7 - 0
generic.h

@@ -1,6 +1,7 @@
 /* generic.h: Header file to be included by all other files
 
    Copyright (C) 2002-2004 Sebastian Reichelt
+   Copyright (C) 2007 Kevin Kofler
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -78,6 +79,12 @@ TIOS_UPGRADE_FILE_SUPPORT
 #define ATTRIBUTE_UNUSED __attribute__((__unused__))
 #define ATTRIBUTE_INTERFACE __attribute__((__cdecl__))
 
+#if defined(__GNUC__) && (__GNUC__>=4 || (__GNUC__==3 && __GNUC_MINOR__>=3))
+#define ATTRIBUTE_MAY_ALIAS __attribute__((__may_alias__))
+#else
+#define ATTRIBUTE_MAY_ALIAS /**/
+#endif
+
 // When compiling an executable, don't do anything with exported functions.
 // Otherwise, default to the cdecl calling convention.
 // When compiling a DLL, also mark the function as exported.

+ 13 - 6
integers.h

@@ -1,6 +1,7 @@
 /* integers.h: Definitions for integers with arbitrary endianness
 
    Copyright (C) 2002-2003 Sebastian Reichelt
+   Copyright (C) 2007 Kevin Kofler
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -49,7 +50,8 @@ typedef I4 ZI4;
 // Defined as structure to avoid unguarded reading/writing.
 typedef struct ATTRIBUTE_PACKED {
 	I1 Val;
-} TI1;
+} TI1_struct;
+typedef TI1_struct ATTRIBUTE_MAY_ALIAS TI1;
 
 // 2 Byte Target Integer
 typedef struct ATTRIBUTE_PACKED {
@@ -58,7 +60,8 @@ typedef struct ATTRIBUTE_PACKED {
 #else /* !TARGET_BIG_ENDIAN */
 	TI1 Lo, Hi;
 #endif /* !TARGET_BIG_ENDIAN */
-} TI2;
+} TI2_struct;
+typedef TI2_struct ATTRIBUTE_MAY_ALIAS TI2;
 
 // 4 Byte Target Integer
 typedef struct ATTRIBUTE_PACKED {
@@ -67,7 +70,8 @@ typedef struct ATTRIBUTE_PACKED {
 #else /* !TARGET_BIG_ENDIAN */
 	TI2 Lo, Hi;
 #endif /* !TARGET_BIG_ENDIAN */
-} TI4;
+} TI4_struct;
+typedef TI4_struct ATTRIBUTE_MAY_ALIAS TI4;
 
 // *** Host Integer Definitions ***
 
@@ -75,7 +79,8 @@ typedef struct ATTRIBUTE_PACKED {
 // Defined as structure to avoid unguarded reading/writing.
 typedef struct ATTRIBUTE_PACKED {
 	unsigned char Val;
-} HI1;
+} HI1_struct;
+typedef HI1_struct ATTRIBUTE_MAY_ALIAS HI1;
 
 // 2 Byte Host Integer
 typedef struct ATTRIBUTE_PACKED {
@@ -84,7 +89,8 @@ typedef struct ATTRIBUTE_PACKED {
 #else /* !HOST_BIG_ENDIAN */
 	HI1 Lo, Hi;
 #endif /* !HOST_BIG_ENDIAN */
-} HI2;
+} HI2_struct;
+typedef HI2_struct ATTRIBUTE_MAY_ALIAS HI2;
 
 // 4 Byte Host Integer
 typedef struct ATTRIBUTE_PACKED {
@@ -93,7 +99,8 @@ typedef struct ATTRIBUTE_PACKED {
 #else /* !HOST_BIG_ENDIAN */
 	HI2 Lo, Hi;
 #endif /* !HOST_BIG_ENDIAN */
-} HI4;
+} HI4_struct;
+typedef HI4_struct ATTRIBUTE_MAY_ALIAS HI4;
 
 // *** Macros to read arbitrary integers ***