diff mbox series

libcpp: Avoid PREV_WHITE and other random content on CPP_PADDING tokens

Message ID 20220201153114.GY2646553@tucnak
State New
Headers show
Series libcpp: Avoid PREV_WHITE and other random content on CPP_PADDING tokens | expand

Commit Message

Jakub Jelinek Feb. 1, 2022, 3:31 p.m. UTC
On Tue, Feb 01, 2022 at 10:03:57AM +0100, Jakub Jelinek via Gcc-patches wrote:
> I wonder if we shouldn't replace that
>       toks[0] = pfile->directive_result;
> line with
>       toks[0] = pfile->avoid_paste;
> or even replace those
>       toks = XNEW (cpp_token);
>       toks[0] = pfile->directive_result;
> lines with
>       toks = &pfile->avoid_paste;

Here is a patch that does that, bootstrapped/regtested on powerpc64le-linux,
ok for trunk?

2022-02-01  Jakub Jelinek  <jakub@redhat.com>

	* directives.cc (destringize_and_run): Push &pfile->avoid_paste
	instead of a copy of pfile->directive_result for the CPP_PADDING
	case.



	Jakub

Comments

Jason Merrill Feb. 1, 2022, 7:26 p.m. UTC | #1
On 2/1/22 10:31, Jakub Jelinek wrote:
> On Tue, Feb 01, 2022 at 10:03:57AM +0100, Jakub Jelinek via Gcc-patches wrote:
>> I wonder if we shouldn't replace that
>>        toks[0] = pfile->directive_result;
>> line with
>>        toks[0] = pfile->avoid_paste;
>> or even replace those
>>        toks = XNEW (cpp_token);
>>        toks[0] = pfile->directive_result;
>> lines with
>>        toks = &pfile->avoid_paste;
> 
> Here is a patch that does that, bootstrapped/regtested on powerpc64le-linux,
> ok for trunk?

OK along with the previous patch and the (checking) assert in 
funlike_invocation_p.

> 2022-02-01  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* directives.cc (destringize_and_run): Push &pfile->avoid_paste
> 	instead of a copy of pfile->directive_result for the CPP_PADDING
> 	case.
> 
> --- libcpp/directives.cc.jj	2022-01-18 11:59:00.257972414 +0100
> +++ libcpp/directives.cc	2022-02-01 13:39:27.240114485 +0100
> @@ -1954,8 +1954,7 @@ destringize_and_run (cpp_reader *pfile,
>     else
>       {
>         count = 1;
> -      toks = XNEW (cpp_token);
> -      toks[0] = pfile->directive_result;
> +      toks = &pfile->avoid_paste;
>   
>         /* If we handled the entire pragma internally, make sure we get the
>   	 line number correct for the next token.  */
> 
> 
> 	Jakub
>
diff mbox series

Patch

--- libcpp/directives.cc.jj	2022-01-18 11:59:00.257972414 +0100
+++ libcpp/directives.cc	2022-02-01 13:39:27.240114485 +0100
@@ -1954,8 +1954,7 @@  destringize_and_run (cpp_reader *pfile,
   else
     {
       count = 1;
-      toks = XNEW (cpp_token);
-      toks[0] = pfile->directive_result;
+      toks = &pfile->avoid_paste;
 
       /* If we handled the entire pragma internally, make sure we get the
 	 line number correct for the next token.  */