aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <merrill@gnu.org>1996-05-06 18:36:48 +0000
committerJason Merrill <merrill@gnu.org>1996-05-06 18:36:48 +0000
commit2786cbadc7943950874df60f65da3f6a081162d9 (patch)
treebe78d9090c203f4f4af7523158cd4c1fe16087a4 /gcc
parent7b8b9722a4c9b7789d3d1bfcc12f23d49eb0b1bf (diff)
downloadgcc-2786cbadc7943950874df60f65da3f6a081162d9.zip
gcc-2786cbadc7943950874df60f65da3f6a081162d9.tar.gz
gcc-2786cbadc7943950874df60f65da3f6a081162d9.tar.bz2
-fno-common change
From-SVN: r11940
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-common.c10
-rw-r--r--gcc/c-decl.c10
-rw-r--r--gcc/final.c2
-rw-r--r--gcc/flags.h3
-rw-r--r--gcc/toplev.c3
-rw-r--r--gcc/varasm.c10
6 files changed, 22 insertions, 16 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index eb6ccaf..3c9018a 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -37,7 +37,7 @@ Boston, MA 02111-1307, USA. */
extern struct obstack permanent_obstack;
-enum attrs {A_PACKED, A_NOCOMMON, A_NORETURN, A_CONST, A_T_UNION,
+enum attrs {A_PACKED, A_NOCOMMON, A_COMMON, A_NORETURN, A_CONST, A_T_UNION,
A_CONSTRUCTOR, A_DESTRUCTOR, A_MODE, A_SECTION, A_ALIGNED,
A_UNUSED, A_FORMAT, A_WEAK, A_ALIAS};
@@ -263,6 +263,7 @@ init_attributes ()
{
add_attribute (A_PACKED, "packed", 0, 0, 0);
add_attribute (A_NOCOMMON, "nocommon", 0, 0, 1);
+ add_attribute (A_COMMON, "common", 0, 0, 1);
add_attribute (A_NORETURN, "noreturn", 0, 0, 1);
add_attribute (A_NORETURN, "volatile", 0, 0, 1);
add_attribute (A_UNUSED, "unused", 0, 0, 1);
@@ -358,6 +359,13 @@ decl_attributes (node, attributes, prefix_attributes)
warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
break;
+ case A_COMMON:
+ if (TREE_CODE (decl) == VAR_DECL)
+ DECL_COMMON (decl) = 1;
+ else
+ warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ break;
+
case A_NORETURN:
if (TREE_CODE (decl) == FUNCTION_DECL)
TREE_THIS_VOLATILE (decl) = 1;
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 38c25eb..e031546 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -3611,9 +3611,13 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
if (TREE_CODE (decl) == FUNCTION_DECL)
gen_aux_info_record (decl, 0, 0, TYPE_ARG_TYPES (TREE_TYPE (decl)) != 0);
- /* For C and Objective-C, we by default put things in .common when
- possible. */
- DECL_COMMON (decl) = 1;
+ /* ANSI specifies that a tentative definition which is not merged with
+ a non-tentative definition behaves exactly like a definition with an
+ initializer equal to zero. (Section 3.7.2)
+ -fno-common gives strict ANSI behavior. Usually you don't want it.
+ This matters only for variables with external linkage. */
+ if (! flag_no_common)
+ DECL_COMMON (decl) = 1;
/* Set attributes here so if duplicate decl, will have proper attributes. */
decl_attributes (decl, attributes, prefix_attributes);
diff --git a/gcc/final.c b/gcc/final.c
index 70aa819..4de4e12 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -405,7 +405,7 @@ end_final (filename)
}
/* Make space for the table of counts. */
- if (flag_no_common || size == 0)
+ if (size == 0)
{
/* Realign data section. */
ASM_OUTPUT_ALIGN (asm_out_file, align);
diff --git a/gcc/flags.h b/gcc/flags.h
index 60528ab..5712f19 100644
--- a/gcc/flags.h
+++ b/gcc/flags.h
@@ -315,7 +315,8 @@ extern int flag_pedantic_errors;
extern int flag_pic;
-/* Nonzero means place uninitialized global data in the bss section. */
+/* Nonzero means don't place uninitialized global data in common storage
+ by default. */
extern int flag_no_common;
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 7fb0810..c89069b 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -482,7 +482,8 @@ int flag_short_temps;
int flag_pic;
-/* Nonzero means place uninitialized global data in the bss section. */
+/* Nonzero means don't place uninitialized global data in common storage
+ by default. */
int flag_no_common;
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 15d749d..468387c 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -1229,18 +1229,11 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
/* Handle uninitialized definitions. */
- /* ANSI specifies that a tentative definition which is not merged with
- a non-tentative definition behaves exactly like a definition with an
- initializer equal to zero. (Section 3.7.2)
- -fno-common gives strict ANSI behavior. Usually you don't want it.
- This matters only for variables with external linkage. */
-
if ((DECL_INITIAL (decl) == 0 || DECL_INITIAL (decl) == error_mark_node)
/* If the target can't output uninitialized but not common global data
in .bss, then we have to use .data. */
#if ! defined (ASM_OUTPUT_BSS) && ! defined (ASM_OUTPUT_ALIGNED_BSS)
- && (! flag_no_common || ! TREE_PUBLIC (decl))
- && DECL_COMMON (decl)
+ && (DECL_COMMON (decl) || ! TREE_PUBLIC (decl))
#endif
&& ! dont_output_data)
{
@@ -1286,7 +1279,6 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
if (TREE_PUBLIC (decl)
#if defined (ASM_OUTPUT_BSS) || defined (ASM_OUTPUT_ALIGNED_BSS)
&& DECL_COMMON (decl)
- && ! flag_no_common
#endif
)
{