public inbox for [email protected]
help / color / mirror / Atom feedFrom: Winter Loo <[email protected]>
To: [email protected]
Subject: [ecpg bug]: can not use single '*' in multi-line comment after c preprocessor directives
Date: Wed, 25 Sep 2024 15:36:48 +0800 (CST)
Message-ID: <[email protected]> (raw)
Hi hackers,
The following code fails to pass the ecpg compilation, although it is accepted by the gcc compiler.
```
#if ABC /* this is a multi-line
* comment including single star character */
int a = 1;
#endif
```
The issue arises from the first '*' in the second line. Upon its removal, the ecpg compiler functions properly.
```
#if ABC /* this is a multi-line
comment without single star character */
int a = 1;
#endif
```
The problem has been identified as a bug in the `cppline` definition within the `pgc.l` file.
```
cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+\/)|.|\\{space}*{newline})*{newline}
```
[Source](https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/interfaces/ecpg/preproc/pgc.l;h=f3c...)
More specifically, the bug originates from the regex pattern for the C block code comment.
```
\/\*[^*/]*\*+\/
```
Attempting another example:
```
#if ABC /* hello * world */
int a = 1;
#endif
```
This time, the ecpg compiler also functions correctly.
Confused! I am uncertain how to rectify the regex. I hope someone can address this bug.
view thread (3+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: [ecpg bug]: can not use single '*' in multi-line comment after c preprocessor directives
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox