This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: function.h/except.h problems
- To: law at cygnus dot com, martin at mira dot isdn dot cs dot tu-berlin dot de
- Subject: Re: function.h/except.h problems
- From: Michael Meissner <meissner at cygnus dot com>
- Date: Thu, 28 May 1998 09:56:38 -0400
- Cc: egcs at cygnus dot com
| > #ifndef NULL_TREE
| > #define tree int *
| > #endif
| > #ifndef GET_CODE
| > #define rtx int *
| > #endif
|
| [...]
| > How do we want to solve this?
|
| Maybe I miss the problem, but what's wrong with
|
| #ifndef NULL_TREE
| typedef int* _tree;
| #define tree _tree
| #endif
| #ifndef GET_CODE
| typedef int* _rtx;
| #define rtx _rtx
| #endif
Umm, these both have problems with type correctness. Trees are a union
pointer, and Rtxs are a struct pointer. Nowhere in the ISO C standard does it
promise that int pointers are the same size and format as struct/union
pointers. The ISO C standard does promise that all union pointers are the same
size and format, and similarly for all struct pointers. This allows you to use
pointers to unknown structures as opaque types.
Anyway, here is the patch I installed:
Thu May 28 09:36:39 1998 Michael Meissner <meissner@cygnus.com>
* except.h (rtx): Define rtx type correctly if needed.
* function.h (rtx): Ditto.
(tree): Define tree type correctly if needed.
* c-pragma.c (toplevel): Include rtl.h.
* stor-layout.c (toplevel): Move include of rtl.h before
except.h.
* Makefile.in (c-pragma.o): Add except.h, rtl.h dependencies.
(tree.o): Add except.h dependency.
*** except.h.~1~ Tue May 19 04:42:22 1998
--- except.h Thu May 28 09:15:32 1998
*************** along with GNU CC; see the file COPYING.
*** 19,27 ****
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
!
! #ifndef GET_CODE
! #define rtx int *
#endif
#ifdef TREE_CODE
--- 19,27 ----
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
! #if !defined(NULL_RTX) && !defined(rtx)
! typedef struct rtx_def *_except_rtx;
! #define rtx _except_rtx
#endif
#ifdef TREE_CODE
*************** rtx expand_builtin_dwarf_reg_size PROTO(
*** 388,390 ****
--- 388,394 ----
int in_same_eh_region PROTO((rtx, rtx));
void free_insn_eh_region PROTO((void));
void init_insn_eh_region PROTO((rtx, int));
+
+ #ifdef rtx
+ #undef rtx
+ #endif
*** function.h.~1~ Thu May 14 09:39:02 1998
--- function.h Thu May 28 09:15:02 1998
*************** the Free Software Foundation, 59 Temple
*** 19,29 ****
Boston, MA 02111-1307, USA. */
! #ifndef NULL_TREE
! #define tree int *
#endif
! #ifndef GET_CODE
! #define rtx int *
#endif
struct var_refs_queue
--- 19,31 ----
Boston, MA 02111-1307, USA. */
! #if !defined(NULL_TREE) && !defined(tree)
! typedef union union_node *_function_tree;
! #define tree _function_tree
#endif
! #if !defined(NULL_RTX) && !defined(rtx)
! typedef struct rtx_def *_function_rtx;
! #define rtx _function_rtx
#endif
struct var_refs_queue
*** c-pragma.c.~1~ Wed May 6 00:45:45 1998
--- c-pragma.c Thu May 28 08:44:55 1998
*************** Boston, MA 02111-1307, USA. */
*** 20,25 ****
--- 20,26 ----
#include "config.h"
#include "system.h"
+ #include "rtl.h"
#include "tree.h"
#include "except.h"
#include "function.h"
*** stor-layout.c.~1~ Mon May 18 09:21:12 1998
--- stor-layout.c Thu May 28 08:55:26 1998
*************** Boston, MA 02111-1307, USA. */
*** 23,32 ****
#include "system.h"
#include "tree.h"
#include "flags.h"
#include "except.h"
#include "function.h"
- #include "rtl.h"
#include "expr.h"
#include "toplev.h"
--- 23,32 ----
#include "system.h"
#include "tree.h"
+ #include "rtl.h"
#include "flags.h"
#include "except.h"
#include "function.h"
#include "expr.h"
#include "toplev.h"
*** Makefile.in.~1~ Thu May 28 08:33:19 1998
--- Makefile.in Thu May 28 09:19:01 1998
*************** c-lex.o : c-lex.c $(CONFIG_H) system.h $
*** 1259,1266 ****
toplev.h output.h
c-aux-info.o : c-aux-info.c $(CONFIG_H) system.h $(TREE_H) c-tree.h flags.h
c-convert.o : c-convert.c $(CONFIG_H) system.h $(TREE_H) flags.h toplev.h
! c-pragma.o: c-pragma.c $(CONFIG_H) system.h $(TREE_H) except.h function.h \
! defaults.h c-pragma.h toplev.h
c-iterate.o: c-iterate.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) c-tree.h \
flags.h toplev.h
--- 1259,1266 ----
toplev.h output.h
c-aux-info.o : c-aux-info.c $(CONFIG_H) system.h $(TREE_H) c-tree.h flags.h
c-convert.o : c-convert.c $(CONFIG_H) system.h $(TREE_H) flags.h toplev.h
! c-pragma.o: c-pragma.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) except.h \
! function.h defaults.h c-pragma.h toplev.h
c-iterate.o: c-iterate.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) c-tree.h \
flags.h toplev.h
*************** prefix.o: prefix.c $(CONFIG_H) system.h
*** 1341,1347 ****
convert.o: convert.c $(CONFIG_H) $(TREE_H) flags.h convert.h toplev.h
! tree.o : tree.c $(CONFIG_H) system.h $(TREE_H) flags.h function.h toplev.h
print-tree.o : print-tree.c $(CONFIG_H) system.h $(TREE_H)
stor-layout.o : stor-layout.c $(CONFIG_H) system.h $(TREE_H) flags.h \
function.h expr.h insn-codes.h $(RTL_H) toplev.h except.h
--- 1341,1347 ----
convert.o: convert.c $(CONFIG_H) $(TREE_H) flags.h convert.h toplev.h
! tree.o : tree.c $(CONFIG_H) system.h $(TREE_H) flags.h function.h toplev.h except.h
print-tree.o : print-tree.c $(CONFIG_H) system.h $(TREE_H)
stor-layout.o : stor-layout.c $(CONFIG_H) system.h $(TREE_H) flags.h \
function.h expr.h insn-codes.h $(RTL_H) toplev.h except.h