This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


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

Re: Problems executing programs which includes rpcndr.h


This is an old problem with C++ parsing of function attribute that is
fixed in gcc-2.95.3.  However the fix has not been incorportaed in
3.0.x branch.  Here is Bob Wilson's patch that has been applied to
2.95.3 (at least in the cygwin and mingw instantiations):

http://gcc.gnu.org/ml/gcc-patches/2001-01/msg01751.html

Have a look at the assembly for the first example you sent.  _malloc@4
looks a bit strange, doesn't it. That is why, in the past, windows.h
had to be included before  

gcc/cp/decl.c has undergone some serious reorganisation. Following is
the above patch refreshed for gcc-3.0.1.


--- decl.c-3.0.1	Tue Sep 04 19:29:10 2001
+++ decl.c	Tue Sep 04 19:38:45 2001
@@ -10469,7 +10469,16 @@ grokdeclarator (declarator, declspecs, d
 	ignore_attrs = 0;
       else if (inner_attrs)
 	{
-	  decl_attributes (type, inner_attrs, NULL_TREE);
+	  /* Create a dummy decl to pass to decl_attributes.  The
+	     attributes will be added to a variant of type, and this
+	     new variant type can be retrieved from the dummy decl.
+	     Passing type directly causes the attributes to be added
+	     to type, which is wrong because type may be used
+	     elsewhere without attributes. */
+
+	  tree dummy = build_decl (TYPE_DECL, NULL_TREE, type);
+	  decl_attributes (dummy, inner_attrs, NULL_TREE);
+	  type = TREE_TYPE (dummy);
 	  inner_attrs = NULL_TREE;
 	}
 
@@ -10988,7 +10997,18 @@ grokdeclarator (declarator, declspecs, d
   if (inner_attrs)
     {
       if (! ignore_attrs)
-	decl_attributes (type, inner_attrs, NULL_TREE);
+	{
+	  /* Create a dummy decl to pass to decl_attributes.  The
+	     attributes will be added to a variant of type, and this
+	     new variant type can be retrieved from the dummy decl.
+	     Passing type directly causes the attributes to be added
+	     to type, which is wrong because type may be used
+	     elsewhere without attributes. */
+
+	  tree dummy = build_decl (TYPE_DECL, NULL_TREE, type);
+	  decl_attributes (dummy, inner_attrs, NULL_TREE);
+	  type = TREE_TYPE (dummy);
+	}
       else if (attrlist)
 	TREE_VALUE (attrlist) = chainon (inner_attrs, TREE_VALUE (attrlist));
       else


Danny



Re: Problems executing programs which includes rpcndr.h
To: cygwin at cygwin dot com 
Subject: Re: Problems executing programs which includes rpcndr.h 
From: David Salotti <david at proximity dot com dot au> 
Date: Tue, 4 Sep 2001 16:28:00 +1000 
Organization: Proximity 
References: <20010903185145.0dc8de2f.david@proximity.com.au> 

--------------------------------------------------------------------------------

Ok, this is pretty weird - but if I rearrange the #include's, I am able
to run
the program successfully??? Does anyone know what's in rpcndr.h that's
conflicting with iostream??

the arrangement that works is:

	#include <rpc.h>
	#include <rpcndr.h>
	#include <iostream>

ta
Dave





_____________________________________________________________________________
http://messenger.yahoo.com.au - Yahoo! Messenger
- Voice chat, mail alerts, stock quotes and favourite news and lots more!

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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