This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Re: Your addition of BT_SSIZE


Hi Diego,
> Is builtin-types.def supposed to be language independent?  If so, could
> you redefine BT_SSIZE so that it doesn't depend on c-tree.h?

My personal opinion is that builtin-types.def clearly isn't language
independent, and trying to pretend that it is doesn't help.  "The first
step is admiting you have a problem".  To quote Zack's GCC Developer
Summit paper:

>> For instance, the Java front end has interesting kludges in it
>> to cope with the allegedly language-independent builtins.def, which
>> is full of C-specific notions like va_list.

To this end, I've managed to remove builtins.def from the f77 and java
front-ends, whilst improving intrinsic support.  Unfortunately, the
fortran 95 seems to have escaped the code clean-up and contains such
interesting kludges as

>> #define flag_isoc99 0


Fortunately, I also appreciate your predicament as branch maintainer.
The following patch exposes signed_size_type_node outside of the C-family
front-ends as a short-term solution.  Correcting how g95 defines fortran
intrinsics and C's builtins can wait until tree-ssa gets merged.  For
example, because g95 currently ignores attributes such as "const", it
may generate worse code than g77 for expressions involving SQRT, EXP,
etc...  Similarly, I doubt that fprintf or even __builtin_eh_return make
much sense when called directly from FORTRAN (but I may be wrong).  The
following patch should atleast allow a merged tree-ssa branch to compile.


The following patch has been tested against mainline on i686-pc-linux-gnu
with a complete "make bootstrap", all languages except treelang, and
regression tested with a top-level "make -k check" with no new failures.

Ok for mainline?


2003-08-18  Roger Sayle  <roger@eyesopen.com>

	* c-common.h (enum c_tree_index): Delete CTI_SIGNED_SIZE_TYPE.
	(signed_size_type_node): No longer a member of c_global_trees.
	* tree.h (enum tree_index): New member TI_SIGNED_SIZE_TYPE here.
	(signed_size_type_node): Moved, now a member of global_trees.


Index: c-common.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.h,v
retrieving revision 1.202
diff -c -3 -p -r1.202 c-common.h
*** c-common.h	5 Aug 2003 21:15:52 -0000	1.202
--- c-common.h	19 Aug 2003 01:21:48 -0000
*************** enum c_tree_index
*** 132,138 ****
      CTI_SIGNED_WCHAR_TYPE,
      CTI_UNSIGNED_WCHAR_TYPE,
      CTI_WINT_TYPE,
-     CTI_SIGNED_SIZE_TYPE, /* For format checking only.  */
      CTI_UNSIGNED_PTRDIFF_TYPE, /* For format checking only.  */
      CTI_INTMAX_TYPE,
      CTI_UINTMAX_TYPE,
--- 132,137 ----
*************** struct c_common_identifier GTY(())
*** 182,188 ****
  #define signed_wchar_type_node		c_global_trees[CTI_SIGNED_WCHAR_TYPE]
  #define unsigned_wchar_type_node	c_global_trees[CTI_UNSIGNED_WCHAR_TYPE]
  #define wint_type_node			c_global_trees[CTI_WINT_TYPE]
- #define signed_size_type_node		c_global_trees[CTI_SIGNED_SIZE_TYPE]
  #define unsigned_ptrdiff_type_node	c_global_trees[CTI_UNSIGNED_PTRDIFF_TYPE]
  #define intmax_type_node		c_global_trees[CTI_INTMAX_TYPE]
  #define uintmax_type_node		c_global_trees[CTI_UINTMAX_TYPE]
--- 181,186 ----
Index: tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.h,v
retrieving revision 1.434
diff -c -3 -p -r1.434 tree.h
*** tree.h	8 Aug 2003 20:23:05 -0000	1.434
--- tree.h	19 Aug 2003 01:21:49 -0000
*************** enum tree_index
*** 1804,1809 ****
--- 1804,1810 ----
    TI_PTR_TYPE,
    TI_CONST_PTR_TYPE,
    TI_SIZE_TYPE,
+   TI_SIGNED_SIZE_TYPE,
    TI_PTRDIFF_TYPE,
    TI_VA_LIST_TYPE,
    TI_BOOLEAN_TYPE,
*************** extern GTY(()) tree global_trees[TI_MAX]
*** 1890,1895 ****
--- 1891,1898 ----
  #define const_ptr_type_node		global_trees[TI_CONST_PTR_TYPE]
  /* The C type `size_t'.  */
  #define size_type_node                  global_trees[TI_SIZE_TYPE]
+ /* The C type `ssize_t'.  */
+ #define signed_size_type_node		global_trees[TI_SIGNED_SIZE_TYPE]
  #define ptrdiff_type_node		global_trees[TI_PTRDIFF_TYPE]
  #define va_list_type_node		global_trees[TI_VA_LIST_TYPE]


Roger
--
Roger Sayle,                         E-mail: roger@eyesopen.com
OpenEye Scientific Software,         WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road,     Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507.         Fax: (+1) 505-473-0833


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]