c-pragma patch/c++ & #pragma pack work again

Nick Clifton nickc@cygnus.com
Sat Oct 10 16:55:00 GMT 1998


: Date: Sat, 10 Oct 1998 01:19:28 -0500
: From: Robert Lipe <robertl@dgii.com>
:
: In cc1 the problematic string is passed to handle_pragma_token() as a
: null terminated string containing "4".
: 
: In cc1plus, the problematic string is passed with a pointer valued 4.
: (Thank heavens we never try to dereference this sucker.)  The code at
: the top of handle_pragma_token goes to some amount of trouble to accept
: this, so I'm not questioning it.  I've tried to propogate the same test
: down and use the value in the token instead of in the passed in string.
: 
: This makes my testuite much, much less noisy but I'm not certain it's
: correct.   Comments, please.
: 
: 	* c-pragma.c (handle_pragma_token): If passed a token instead
: 	of a tree, use that as the pack value.
: 
: Index: c-pragma.c
: ===================================================================
: RCS file: /egcs/carton/cvsfiles/egcs/gcc/c-pragma.c,v
: retrieving revision 1.10
: diff -u -p -r1.10 c-pragma.c
: --- c-pragma.c  1998/10/07 14:41:42     1.10
: +++ c-pragma.c  1998/10/10 06:05:41
: @@ -384,7 +384,11 @@ handle_pragma_token (string, token)
:        break;
: 
:      case ps_left:
: -      align = atoi (string);
: +
: +      if (TREE_CODE(token) == INTEGER_CST)
: +       align = TREE_INT_CST_LOW(token);
: +      else
: +       align = atoi (string);
:        switch (align)
:         {
:         case 1:
: 
 

Woops!  Thanks for spotting that one.  Your patch is dead on.  With
Jeff's permission I will apply the patch.

Cheers
	Nick




More information about the Gcc-patches mailing list