aboutsummaryrefslogtreecommitdiff
path: root/gcc/treelang
diff options
context:
space:
mode:
authorJames A. Morrison <phython@gcc.gnu.org>2005-02-26 14:10:11 +0000
committerJames A. Morrison <phython@gcc.gnu.org>2005-02-26 14:10:11 +0000
commitabbb62e99164a6c7da5eab8c834082b15b636be3 (patch)
tree501f74118c4c47b831cb624bb8a13a406b4b409d /gcc/treelang
parent9a8e31dfee42a111decf7a33fae5244c546dd839 (diff)
2005-02-26 James A. Morrison <phython@gcc.gnu.org>
* treelang.texi: Treelang does have warnings. * treetree.c (tree_code_create_function_prototype): Don't set TREE_USED and set TREE_PUBLIC, DECL_EXTERNAL, and TREE_STATIC as few times as needed on the function declaration. (tree_code_create_function_initial): Don't set TREE_USED, TREE_ADDRESSABLE, but set TREE_STATIC on the function declaration. (tree_code_create_variable): Don't set TREE_USED on VAR_DECL. (tree_code_get_expression): Set TREE_USED for variable references and function calls. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@95580 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/treelang')
-rw-r--r--gcc/treelang/ChangeLog12
-rw-r--r--gcc/treelang/treelang.texi8
-rw-r--r--gcc/treelang/treetree.c17
3 files changed, 20 insertions, 17 deletions
diff --git a/gcc/treelang/ChangeLog b/gcc/treelang/ChangeLog
index c1a2da61190..d428afdabe4 100644
--- a/gcc/treelang/ChangeLog
+++ b/gcc/treelang/ChangeLog
@@ -1,5 +1,17 @@
2005-02-26 James A. Morrison <phython@gcc.gnu.org>
+ * treelang.texi: Treelang does have warnings.
+ * treetree.c (tree_code_create_function_prototype): Don't set
+ TREE_USED and set TREE_PUBLIC, DECL_EXTERNAL, and TREE_STATIC
+ as few times as needed on the function declaration.
+ (tree_code_create_function_initial): Don't set TREE_USED,
+ TREE_ADDRESSABLE, but set TREE_STATIC on the function declaration.
+ (tree_code_create_variable): Don't set TREE_USED on VAR_DECL.
+ (tree_code_get_expression): Set TREE_USED for variable references
+ and function calls.
+
+2005-02-26 James A. Morrison <phython@gcc.gnu.org>
+
* parse.y: Do comparisons as the type of the first expression.
* treetree.c (tree_code_get_integer_value): Build integer constants
with the proper type.
diff --git a/gcc/treelang/treelang.texi b/gcc/treelang/treelang.texi
index bc6e75ba8e4..09d93d45ba5 100644
--- a/gcc/treelang/treelang.texi
+++ b/gcc/treelang/treelang.texi
@@ -710,9 +710,11 @@ the programmer's intention.)
@cindex warnings
@cindex questionable instructions
@item
-There are few warnings in treelang. A program is either correct or in
-error. The only exception to this is an expression in a return statement for
-functions that return nothing.
+There are a few warnings in treelang. For example an unused static function
+generate a warnings when -Wunused-function is specified, similarily an unused
+static variable generates a warning when -Wunused-variable are specified.
+The only treelang specific warning is a warning when an expression is in a
+return statement for functions that return void.
@end itemize
@cindex components of treelang
diff --git a/gcc/treelang/treetree.c b/gcc/treelang/treetree.c
index dcb7cd351a0..ac8c7a39494 100644
--- a/gcc/treelang/treetree.c
+++ b/gcc/treelang/treetree.c
@@ -352,25 +352,19 @@ tree_code_create_function_prototype (unsigned char* chars,
DECL_CONTEXT (fn_decl) = NULL_TREE;
DECL_SOURCE_LOCATION (fn_decl) = loc;
- TREE_USED (fn_decl) = 1;
-
TREE_PUBLIC (fn_decl) = 0;
DECL_EXTERNAL (fn_decl) = 0;
TREE_STATIC (fn_decl) = 0;
switch (storage_class)
{
case STATIC_STORAGE:
- TREE_PUBLIC (fn_decl) = 0;
break;
case EXTERNAL_DEFINITION_STORAGE:
TREE_PUBLIC (fn_decl) = 1;
- TREE_STATIC (fn_decl) = 0;
- DECL_EXTERNAL (fn_decl) = 0;
break;
case EXTERNAL_REFERENCE_STORAGE:
- TREE_PUBLIC (fn_decl) = 0;
DECL_EXTERNAL (fn_decl) = 1;
break;
@@ -457,11 +451,7 @@ tree_code_create_function_initial (tree prev_saved,
pushlevel (0);
- /* Force it to be output, else may be solely inlined. */
- TREE_ADDRESSABLE (fn_decl) = 1;
-
- /* Stop -O3 from deleting it. */
- TREE_USED (fn_decl) = 1;
+ TREE_STATIC (fn_decl) = 1;
}
/* Wrapup a function contained in file FILENAME, ending at line LINENO. */
@@ -570,9 +560,6 @@ tree_code_create_variable (unsigned int storage_class,
gcc_unreachable ();
}
- /* This should really only be set if the variable is used. */
- TREE_USED (var_decl) = 1;
-
TYPE_NAME (TREE_TYPE (var_decl)) = TYPE_NAME (var_type);
return pushdecl (copy_node (var_decl));
}
@@ -701,6 +688,7 @@ tree_code_get_expression (unsigned int exp_type,
variable type, convert it. */
case EXP_REFERENCE:
gcc_assert (op1);
+ TREE_USED (op1) = 1;
if (type == TREE_TYPE (op1))
ret1 = op1;
else
@@ -711,6 +699,7 @@ tree_code_get_expression (unsigned int exp_type,
gcc_assert (op1);
{
tree fun_ptr;
+ TREE_USED (op1) = 1;
fun_ptr = fold (build1 (ADDR_EXPR,
build_pointer_type (TREE_TYPE (op1)), op1));
ret1 = build3 (CALL_EXPR, type, fun_ptr, nreverse (op2), NULL_TREE);