aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatoly Sokolov <aesok@post.ru>2009-03-15 16:09:44 +0300
committerAnatoly Sokolov <aesok@gcc.gnu.org>2009-03-15 16:09:44 +0300
commit2cb4817bd3b8818b7897beff61ada79370515fd5 (patch)
tree365229bb370e295b089f83525fc4b9d1fd472c32
parent58366b08d75c36e76695b8dedda3aecb38e4dc51 (diff)
downloadgcc-2cb4817bd3b8818b7897beff61ada79370515fd5.zip
gcc-2cb4817bd3b8818b7897beff61ada79370515fd5.tar.gz
gcc-2cb4817bd3b8818b7897beff61ada79370515fd5.tar.bz2
re PR target/34299 ([avr] ICE on function attribute syntax for main())
PR target/34299 * config/avr/avr.c (avr_handle_fndecl_attribute): Move code for generate a warning if the function name does not begin with "__vector" and the function has either the 'signal' or 'interrupt' attribute, from here to ... (avr_declare_function_name): ...here. New function. * config/avr/avr.h (ASM_DECLARE_FUNCTION_NAME): Redefine. * config/avr/avr-protos.h (avr_declare_function_name): Declare. From-SVN: r144870
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/config/avr/avr-protos.h3
-rw-r--r--gcc/config/avr/avr.c59
-rw-r--r--gcc/config/avr/avr.h5
4 files changed, 47 insertions, 31 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5cd91bd..f8a2358 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2009-03-14 Anatoly Sokolov <aesok@post.ru>
+
+ PR target/34299
+ * config/avr/avr.c (avr_handle_fndecl_attribute): Move code for
+ generate a warning if the function name does not begin with
+ "__vector" and the function has either the 'signal' or 'interrupt'
+ attribute, from here to ...
+ (avr_declare_function_name): ...here. New function.
+ * config/avr/avr.h (ASM_DECLARE_FUNCTION_NAME): Redefine.
+ * config/avr/avr-protos.h (avr_declare_function_name): Declare.
+
2009-03-14 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/39454
diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h
index bcf81d9..2df4a16 100644
--- a/gcc/config/avr/avr-protos.h
+++ b/gcc/config/avr/avr-protos.h
@@ -1,6 +1,6 @@
/* Prototypes for exported functions defined in avr.c
- Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008
+ Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
Contributed by Denis Chertykov (denisc@overta.ru)
@@ -32,6 +32,7 @@ extern enum reg_class avr_regno_reg_class (int r);
extern enum reg_class avr_reg_class_from_letter (int c);
extern int frame_pointer_required_p (void);
extern void asm_globalize_label (FILE *file, const char *name);
+extern void avr_asm_declare_function_name (FILE *, const char *, tree);
extern void order_regs_for_local_alloc (void);
extern int initial_elimination_offset (int from, int to);
extern int avr_simple_epilogue (void);
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index f8ef6d5..08aace6 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -4595,6 +4595,39 @@ avr_assemble_integer (rtx x, unsigned int size, int aligned_p)
return default_assemble_integer (x, size, aligned_p);
}
+/* Worker function for ASM_DECLARE_FUNCTION_NAME. */
+
+void
+avr_asm_declare_function_name (FILE *file, const char *name, tree decl)
+{
+
+ /* If the function has the 'signal' or 'interrupt' attribute, test to
+ make sure that the name of the function is "__vector_NN" so as to
+ catch when the user misspells the interrupt vector name. */
+
+ if (cfun->machine->is_interrupt)
+ {
+ if (strncmp (name, "__vector", strlen ("__vector")) != 0)
+ {
+ warning_at (DECL_SOURCE_LOCATION (decl), 0,
+ "%qs appears to be a misspelled interrupt handler",
+ name);
+ }
+ }
+ else if (cfun->machine->is_signal)
+ {
+ if (strncmp (name, "__vector", strlen ("__vector")) != 0)
+ {
+ warning_at (DECL_SOURCE_LOCATION (decl), 0,
+ "%qs appears to be a misspelled signal handler",
+ name);
+ }
+ }
+
+ ASM_OUTPUT_TYPE_DIRECTIVE (file, name, "function");
+ ASM_OUTPUT_LABEL (file, name);
+}
+
/* The routine used to output NUL terminated strings. We use a special
version of this for most svr4 targets because doing so makes the
generated assembly code more compact (and thus faster to assemble)
@@ -4779,32 +4812,6 @@ avr_handle_fndecl_attribute (tree *node, tree name,
IDENTIFIER_POINTER (name));
*no_add_attrs = true;
}
- else
- {
- const char *func_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (*node));
- const char *attr = IDENTIFIER_POINTER (name);
-
- /* If the function has the 'signal' or 'interrupt' attribute, test to
- make sure that the name of the function is "__vector_NN" so as to
- catch when the user misspells the interrupt vector name. */
-
- if (strncmp (attr, "interrupt", strlen ("interrupt")) == 0)
- {
- if (strncmp (func_name, "__vector", strlen ("__vector")) != 0)
- {
- warning (0, "%qs appears to be a misspelled interrupt handler",
- func_name);
- }
- }
- else if (strncmp (attr, "signal", strlen ("signal")) == 0)
- {
- if (strncmp (func_name, "__vector", strlen ("__vector")) != 0)
- {
- warning (0, "%qs appears to be a misspelled signal handler",
- func_name);
- }
- }
- }
return NULL_TREE;
}
diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h
index 8a4d98a..c41ac0b 100644
--- a/gcc/config/avr/avr.h
+++ b/gcc/config/avr/avr.h
@@ -590,10 +590,7 @@ do { \
specific tm.h file (depending upon the particulars of your assembler). */
#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
-do { \
- ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
- ASM_OUTPUT_LABEL (FILE, NAME); \
-} while (0)
+avr_asm_declare_function_name ((FILE), (NAME), (DECL))
#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
do { \