aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.h
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>2004-06-30 10:58:21 -0700
committerPer Bothner <bothner@gcc.gnu.org>2004-06-30 10:58:21 -0700
commitc166747038bc41ee6702618828e5c915cc4e47ea (patch)
treebf7c0b00dcfa76e28cdeb61f5339d2924ef9dc16 /gcc/tree.h
parentb5674962f18be68ae4b22042b09fd251ccd09ed1 (diff)
downloadgcc-c166747038bc41ee6702618828e5c915cc4e47ea.zip
gcc-c166747038bc41ee6702618828e5c915cc4e47ea.tar.gz
gcc-c166747038bc41ee6702618828e5c915cc4e47ea.tar.bz2
Conditionally compile support for --enable-mapped_location.
* input.h: #include line-map.h for source_location typedef. (BUILTINS_LOCATION, UNKNOWN_LOCATION, expand_location, LOCATION_FILE, LOCATION_LINE): New macros and functions. (expanded_location, source_locus): New typedefs. (push_srcloc): Change parameter list if USE_MAPPED_LOCATION. * rtl.def (NOTE, ASM_OPERANDS): Modify specifcation, if USE_MAPPED_LOCATION. * rtl.h (NOTE_DELETED_LABEL_NAME): New macro. (NOTE_SOURCE_LOCATION, NOTE_EXPNDED_LOCATION, SET_INSN_DELETED): New conditional macros. (ASM_OPERANDS_SOURCE_FILE, ASM_OPERANDS_SOURCE_LINE): Replace by ASM_OPERANDS_SOURCE_LOCATION if USE_MAPPED_LOCATION. * tree.h (EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_HAS_LOCATION, EXPR_LOCUS, SET_EXPR_LOCUS, EXPR_FILENAME, EXPR_LINENO, DECL_IS_BUILTIN): New macros, most depending on USE_MAPPED__LOCATION. (tree_exp): Change type of locus to use new source_locus typedef. * tree.c (build1_stat): Use SET_EXPR_LOCATION. (annotate_with_locus, annotate_with_file_line): Conditionalize. (expand_location): New function. * toplev.c (unknown_location): New static, when USE_MAPPED_LOCATION. (push_srcloc, pop_loc): Adjust parameter handling. (process_options): Don't set input_filename by itself. (lang_dependent_init): Save, set input_location to <built-in>. (warn_deprecated_use): Use expand_location. From-SVN: r83918
Diffstat (limited to 'gcc/tree.h')
-rw-r--r--gcc/tree.h50
1 files changed, 39 insertions, 11 deletions
diff --git a/gcc/tree.h b/gcc/tree.h
index fdabc24..4c4a275 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1073,6 +1073,31 @@ struct tree_vec GTY(())
/* In a LOOP_EXPR node. */
#define LOOP_EXPR_BODY(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_EXPR, 0)
+#ifdef USE_MAPPED_LOCATION
+/* The source location of this expression. Non-tree_exp nodes such as
+ decls and constants can be shared among multiple locations, so
+ return nothing. */
+#define EXPR_LOCATION(NODE) \
+ (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (NODE))) \
+ ? (NODE)->exp.locus \
+ : UNKNOWN_LOCATION)
+#define SET_EXPR_LOCATION(NODE, FROM) \
+ (EXPR_CHECK (NODE)->exp.locus = (FROM))
+#define EXPR_HAS_LOCATION(NODE) (EXPR_LOCATION (NODE) != UNKNOWN_LOCATION)
+/* EXPR_LOCUS and SET_EXPR_LOCUS are deprecated. */
+#define EXPR_LOCUS(NODE) \
+ (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (NODE))) \
+ ? &(NODE)->exp.locus \
+ : (location_t *)NULL)
+#define SET_EXPR_LOCUS(NODE, FROM) \
+ do { source_location *loc_tmp = FROM; \
+ EXPR_CHECK (NODE)->exp.locus \
+ = loc_tmp == NULL ? UNKNOWN_LOCATION : *loc_tmp; } while (0)
+#define EXPR_FILENAME(NODE) \
+ LOCATION_FILE (EXPR_CHECK (NODE)->exp.locus)
+#define EXPR_LINENO(NODE) \
+ LOCATION_LINE (EXPR_CHECK (NODE)->exp.locus)
+#else
/* The source location of this expression. Non-tree_exp nodes such as
decls and constants can be shared among multiple locations, so
return nothing. */
@@ -1082,19 +1107,14 @@ struct tree_vec GTY(())
: (location_t *)NULL)
#define SET_EXPR_LOCUS(NODE, FROM) \
(EXPR_CHECK (NODE)->exp.locus = (FROM))
+#define SET_EXPR_LOCATION(NODE, FROM) annotate_with_locus (NODE, FROM)
#define EXPR_FILENAME(NODE) \
(EXPR_CHECK (NODE)->exp.locus->file)
#define EXPR_LINENO(NODE) \
(EXPR_CHECK (NODE)->exp.locus->line)
-#ifdef USE_MAPPED_LOCATION
-#define EXPR_LOCATION(NODE) \
- (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (NODE))) \
- ? (NODE)->exp.locus \
- : UNKNOWN_LOCATION)
-#define EXPR_HAS_LOCATION(NODE) (EXPR_LOCATION (NODE) != UNKNOWN_LOCATION)
-#else
-#define EXPR_LOCATION(NODE) (*EXPR_LOCUS (NODE))
#define EXPR_HAS_LOCATION(NODE) (EXPR_LOCUS (NODE) != NULL)
+#define EXPR_LOCATION(NODE) \
+ (EXPR_HAS_LOCATION(NODE) ? *(NODE)->exp.locus : UNKNOWN_LOCATION)
#endif
/* In a TARGET_EXPR node. */
@@ -1172,7 +1192,7 @@ struct tree_vec GTY(())
struct tree_exp GTY(())
{
struct tree_common common;
- location_t *locus;
+ source_locus locus;
int complexity;
tree block;
tree GTY ((special ("tree_exp"),
@@ -1773,8 +1793,14 @@ struct tree_type GTY(())
function that is declared first and then defined later), this
information should refer to the definition. */
#define DECL_SOURCE_LOCATION(NODE) (DECL_CHECK (NODE)->decl.locus)
-#define DECL_SOURCE_FILE(NODE) (DECL_SOURCE_LOCATION (NODE).file)
-#define DECL_SOURCE_LINE(NODE) (DECL_SOURCE_LOCATION (NODE).line)
+#define DECL_SOURCE_FILE(NODE) LOCATION_FILE (DECL_SOURCE_LOCATION (NODE))
+#define DECL_SOURCE_LINE(NODE) LOCATION_LINE (DECL_SOURCE_LOCATION (NODE))
+#ifdef USE_MAPPED_LOCATION
+#define DECL_IS_BUILTIN(DECL) \
+ (DECL_SOURCE_LOCATION (DECL) <= BUILTINS_LOCATION)
+#else
+#define DECL_IS_BUILTIN(DECL) (DECL_SOURCE_LINE(DECL) == 0)
+#endif
/* Holds the size of the datum, in bits, as a tree expression.
Need not be constant. */
#define DECL_SIZE(NODE) (DECL_CHECK (NODE)->decl.size)
@@ -2665,8 +2691,10 @@ extern tree build_tree_list_stat (tree, tree MEM_STAT_DECL);
extern tree build_decl_stat (enum tree_code, tree, tree MEM_STAT_DECL);
#define build_decl(c,t,q) build_decl_stat (c,t,q MEM_STAT_INFO)
extern tree build_block (tree, tree, tree, tree, tree);
+#ifndef USE_MAPPED_LOCATION
extern void annotate_with_file_line (tree, const char *, int);
extern void annotate_with_locus (tree, location_t);
+#endif
extern tree build_empty_stmt (void);
/* Construct various nodes representing data types. */