This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
include tree.h instead of tree-core.h in expr.h
- From: Prathamesh Kulkarni <bilbotheelffriend at gmail dot com>
- To: gcc <gcc at gcc dot gnu dot org>
- Date: Wed, 18 Dec 2013 17:27:36 +0530
- Subject: include tree.h instead of tree-core.h in expr.h
- Authentication-results: sourceware.org; auth=none
In expr.h:
/* For tree_fits_[su]hwi_p, tree_to_[su]hwi, fold_convert, size_binop,
ssize_int, TREE_CODE, TYPE_SIZE, int_size_in_bytes, */
#include "tree-core.h"
However the functions tree_to_shwi(), tree_fits_shwi(), etc.
are not declared in tree-core.h, but in tree.h
This is not a problem because tree_to_shwi() gets called from within
macros in expr.h,
(eg: from ADD_PARM_SIZE and SUB_PARM_SIZE macros), and when these
macros are called, tree.h has been already included in that
translation unit before including expr.h (for example, in alias.c
tree.h, is included before expr.h).
I am replacing macros by static inline functions
(http://gcc.gnu.org/ml/gcc/2013-12/msg00148.html), changing
ADD_PARM_SIZE() from macro to
function now gives an error, that tree_to_shwi() (and other things
like ssizetype, etc.) are not defined in scope. Including tree.h
removes these errors.
Would it be better to include tree.h instead of tree-core.h (tree.h
includes tree-core.h anyway), or shall I leave these macros untouched
?
Thanks and Regards,
Prathamesh