testsuite: Add test for already-fixed issue with _Pragma expansion [PR90400]

Message ID 20230825204554.2440771-1-lhyatt@gmail.com
State Accepted
Headers
Series testsuite: Add test for already-fixed issue with _Pragma expansion [PR90400] |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Lewis Hyatt Aug. 25, 2023, 8:45 p.m. UTC
  Hello-

This is adding a testcase for a PR that was already incidentally fixed. OK
to commit please? Thanks...

-Lewis

-- >8 --

The PR was fixed by r12-5454. Since the fix was somewhat incidental,
although related, add a testcase from PR90400 too before closing it out.

gcc/testsuite/ChangeLog:

	PR preprocessor/90400
	* c-c++-common/cpp/pr90400.c: New test.
---
 gcc/testsuite/c-c++-common/cpp/pr90400.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 gcc/testsuite/c-c++-common/cpp/pr90400.c
  

Comments

Lewis Hyatt Sept. 8, 2023, 8:14 p.m. UTC | #1
Hello-

May I please ping this one? It's adding a testcase prior to closing
the PR. Thanks!
https://gcc.gnu.org/pipermail/gcc-patches/2023-August/628488.html

-Lewis

On Fri, Aug 25, 2023 at 4:46 PM Lewis Hyatt <lhyatt@gmail.com> wrote:
>
> Hello-
>
> This is adding a testcase for a PR that was already incidentally fixed. OK
> to commit please? Thanks...
>
> -Lewis
>
> -- >8 --
>
> The PR was fixed by r12-5454. Since the fix was somewhat incidental,
> although related, add a testcase from PR90400 too before closing it out.
>
> gcc/testsuite/ChangeLog:
>
>         PR preprocessor/90400
>         * c-c++-common/cpp/pr90400.c: New test.
> ---
>  gcc/testsuite/c-c++-common/cpp/pr90400.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>  create mode 100644 gcc/testsuite/c-c++-common/cpp/pr90400.c
>
> diff --git a/gcc/testsuite/c-c++-common/cpp/pr90400.c b/gcc/testsuite/c-c++-common/cpp/pr90400.c
> new file mode 100644
> index 00000000000..4f2cab8d6ab
> --- /dev/null
> +++ b/gcc/testsuite/c-c++-common/cpp/pr90400.c
> @@ -0,0 +1,14 @@
> +/* { dg-do compile } */
> +/* { dg-additional-options "-save-temps" } */
> +/* PR preprocessor/90400 */
> +
> +#define OUTER(x) x
> +#define FOR(x) _Pragma ("GCC unroll 0") for (x)
> +void f ()
> +{
> +    /* If the pragma were to be seen prior to the expansion of FOR, as was
> +       the case before r12-5454, then the unroll pragma would complain
> +       because the immediately following statement would be ";" rather than
> +       a loop.  */
> +    OUTER (; FOR (int i = 0; i != 1; ++i);) /* { dg-bogus {statement expected before ';' token} } */
> +}
  
Richard Sandiford Sept. 20, 2023, 7:46 p.m. UTC | #2
Lewis Hyatt via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> Hello-
>
> May I please ping this one? It's adding a testcase prior to closing
> the PR. Thanks!
> https://gcc.gnu.org/pipermail/gcc-patches/2023-August/628488.html

OK, thanks.  (Not really my area, but someone would probably have
objected by now if they were going to.)

Richard

>
> -Lewis
>
> On Fri, Aug 25, 2023 at 4:46 PM Lewis Hyatt <lhyatt@gmail.com> wrote:
>>
>> Hello-
>>
>> This is adding a testcase for a PR that was already incidentally fixed. OK
>> to commit please? Thanks...
>>
>> -Lewis
>>
>> -- >8 --
>>
>> The PR was fixed by r12-5454. Since the fix was somewhat incidental,
>> although related, add a testcase from PR90400 too before closing it out.
>>
>> gcc/testsuite/ChangeLog:
>>
>>         PR preprocessor/90400
>>         * c-c++-common/cpp/pr90400.c: New test.
>> ---
>>  gcc/testsuite/c-c++-common/cpp/pr90400.c | 14 ++++++++++++++
>>  1 file changed, 14 insertions(+)
>>  create mode 100644 gcc/testsuite/c-c++-common/cpp/pr90400.c
>>
>> diff --git a/gcc/testsuite/c-c++-common/cpp/pr90400.c b/gcc/testsuite/c-c++-common/cpp/pr90400.c
>> new file mode 100644
>> index 00000000000..4f2cab8d6ab
>> --- /dev/null
>> +++ b/gcc/testsuite/c-c++-common/cpp/pr90400.c
>> @@ -0,0 +1,14 @@
>> +/* { dg-do compile } */
>> +/* { dg-additional-options "-save-temps" } */
>> +/* PR preprocessor/90400 */
>> +
>> +#define OUTER(x) x
>> +#define FOR(x) _Pragma ("GCC unroll 0") for (x)
>> +void f ()
>> +{
>> +    /* If the pragma were to be seen prior to the expansion of FOR, as was
>> +       the case before r12-5454, then the unroll pragma would complain
>> +       because the immediately following statement would be ";" rather than
>> +       a loop.  */
>> +    OUTER (; FOR (int i = 0; i != 1; ++i);) /* { dg-bogus {statement expected before ';' token} } */
>> +}
  

Patch

diff --git a/gcc/testsuite/c-c++-common/cpp/pr90400.c b/gcc/testsuite/c-c++-common/cpp/pr90400.c
new file mode 100644
index 00000000000..4f2cab8d6ab
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/pr90400.c
@@ -0,0 +1,14 @@ 
+/* { dg-do compile } */
+/* { dg-additional-options "-save-temps" } */
+/* PR preprocessor/90400 */
+
+#define OUTER(x) x
+#define FOR(x) _Pragma ("GCC unroll 0") for (x)
+void f ()
+{
+    /* If the pragma were to be seen prior to the expansion of FOR, as was
+       the case before r12-5454, then the unroll pragma would complain
+       because the immediately following statement would be ";" rather than
+       a loop.  */
+    OUTER (; FOR (int i = 0; i != 1; ++i);) /* { dg-bogus {statement expected before ';' token} } */
+}