This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [Updated] dllimport/dllexport attributes for Win32/BeOS


On 26 Jun 1998, Jason Merrill wrote:

> 
> I had in mind a more general macro, something like DECL_NONSTATIC_P (but
> preferably with a better name...).  The reason you can't take its address
> is not important.
> 

How about the following change to generic code:

Sat Jun 27 11:51:48 1998  Mumit Khan <khan@xraylith.wisc.edu>

	* tree.h (DECL_NON_ADDR_CONST_P): New accessor macro.
	(struct tree_decl): Add non_addr_const_p field.
	* tree.c (staticp): Use.

Index: tree.h
===================================================================
RCS file: /home/khan/src/CVSROOT/gnu/egcs/gcc/tree.h,v
retrieving revision 1.1.1.2
diff -u -3 -p -r1.1.1.2 tree.h
--- tree.h	1998/05/24 23:38:48	1.1.1.2
+++ tree.h	1998/06/27 16:46:05
@@ -1186,6 +1186,10 @@ struct tree_type
 #define DECL_LANG_FLAG_6(NODE) (DECL_CHECK (NODE)->decl.lang_flag_6)
 #define DECL_LANG_FLAG_7(NODE) (DECL_CHECK (NODE)->decl.lang_flag_7)
 
+/* Used to indicate that the pointer to this DECL cannot be treated as
+   an address constant.  */
+#define DECL_NON_ADDR_CONST_P(NODE) (DECL_CHECK (NODE)->decl.non_addr_const_p)
+
 struct tree_decl
 {
   char common[sizeof (struct tree_common)];
@@ -1226,6 +1230,8 @@ struct tree_decl
   unsigned lang_flag_5 : 1;
   unsigned lang_flag_6 : 1;
   unsigned lang_flag_7 : 1;
+
+  unsigned non_addr_const_p : 1;
 
   /* For a FUNCTION_DECL, if inline, this is the size of frame needed.
      If built-in, this is the code for which built-in function.
Index: tree.c
===================================================================
RCS file: /home/khan/src/CVSROOT/gnu/egcs/gcc/tree.c,v
retrieving revision 1.1.1.2
diff -u -3 -p -r1.1.1.2 tree.c
--- tree.c	1998/05/24 23:38:48	1.1.1.2
+++ tree.c	1998/06/27 16:50:15
@@ -2256,9 +2256,12 @@ staticp (arg)
     case FUNCTION_DECL:
       /* Nested functions aren't static, since taking their address
 	 involves a trampoline.  */
-       return decl_function_context (arg) == 0 || DECL_NO_STATIC_CHAIN (arg);
+       return (decl_function_context (arg) == 0 || DECL_NO_STATIC_CHAIN (arg))
+              && ! DECL_NON_ADDR_CONST_P (arg);
+
     case VAR_DECL:
-      return TREE_STATIC (arg) || DECL_EXTERNAL (arg);
+      return (TREE_STATIC (arg) || DECL_EXTERNAL (arg))
+             && ! DECL_NON_ADDR_CONST_P (arg);
 
     case CONSTRUCTOR:
       return TREE_STATIC (arg);



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]