glibcextract.py: Place un-assemblable @@@ in a comment

Message ID 20211008014014.800723-1-maskray@google.com
State New
Headers show
Series
  • glibcextract.py: Place un-assemblable @@@ in a comment
Related show

Commit Message

Noah Goldstein via Libc-alpha Oct. 8, 2021, 1:40 a.m.
Unlike GCC, Clang passes asm statements and verifies they are valid
instructions/directives. Place the magic @@@ into a comment to avoid
a parse error.
---
 scripts/glibcextract.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.33.0.882.g93a45727a2-goog

Comments

Noah Goldstein via Libc-alpha Oct. 15, 2021, 4:29 p.m. | #1
On 2021-10-07, Fangrui Song wrote:
>Unlike GCC, Clang passes asm statements and verifies they are valid

>instructions/directives. Place the magic @@@ into a comment to avoid

>a parse error.

>---

> scripts/glibcextract.py | 2 +-

> 1 file changed, 1 insertion(+), 1 deletion(-)

>

>diff --git a/scripts/glibcextract.py b/scripts/glibcextract.py

>index 752ff6223b..bf49a5e322 100644

>--- a/scripts/glibcextract.py

>+++ b/scripts/glibcextract.py

>@@ -45,7 +45,7 @@ def compute_c_consts(sym_data, cc):

>             continue

>         name = arg[0]

>         value = arg[1]

>-        out_lines.append('asm ("@@@name@@@%s@@@value@@@%%0@@@end@@@" '

>+        out_lines.append('asm ("/* @@@name@@@%s@@@value@@@%%0@@@end@@@ */" '

>                          ': : \"i\" ((long int) (%s)));'

>                          % (name, value))

>     out_lines.append('}')

>-- 

>2.33.0.882.g93a45727a2-goog

>


Ping..
Noah Goldstein via Libc-alpha Oct. 19, 2021, 6:18 a.m. | #2
On Fri, Oct 15, 2021 at 9:29 AM Fangrui Song <maskray@google.com> wrote:
>

> On 2021-10-07, Fangrui Song wrote:

> >Unlike GCC, Clang passes asm statements and verifies they are valid

> >instructions/directives. Place the magic @@@ into a comment to avoid

> >a parse error.

> >---

> > scripts/glibcextract.py | 2 +-

> > 1 file changed, 1 insertion(+), 1 deletion(-)

> >

> >diff --git a/scripts/glibcextract.py b/scripts/glibcextract.py

> >index 752ff6223b..bf49a5e322 100644

> >--- a/scripts/glibcextract.py

> >+++ b/scripts/glibcextract.py

> >@@ -45,7 +45,7 @@ def compute_c_consts(sym_data, cc):

> >             continue

> >         name = arg[0]

> >         value = arg[1]

> >-        out_lines.append('asm ("@@@name@@@%s@@@value@@@%%0@@@end@@@" '

> >+        out_lines.append('asm ("/* @@@name@@@%s@@@value@@@%%0@@@end@@@ */" '

> >                          ': : \"i\" ((long int) (%s)));'

> >                          % (name, value))

> >     out_lines.append('}')

> >--

> >2.33.0.882.g93a45727a2-goog

> >

>

> Ping..


This seems trivial and straightforward. I'll give a few days and then push it.
Noah Goldstein via Libc-alpha Oct. 19, 2021, 7:40 a.m. | #3
* Fangrui Song via Libc-alpha:

> Unlike GCC, Clang passes asm statements and verifies they are valid

> instructions/directives. Place the magic @@@ into a comment to avoid

> a parse error.

> ---

>  scripts/glibcextract.py | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

>

> diff --git a/scripts/glibcextract.py b/scripts/glibcextract.py

> index 752ff6223b..bf49a5e322 100644

> --- a/scripts/glibcextract.py

> +++ b/scripts/glibcextract.py

> @@ -45,7 +45,7 @@ def compute_c_consts(sym_data, cc):

>              continue

>          name = arg[0]

>          value = arg[1]

> -        out_lines.append('asm ("@@@name@@@%s@@@value@@@%%0@@@end@@@" '

> +        out_lines.append('asm ("/* @@@name@@@%s@@@value@@@%%0@@@end@@@ */" '

>                           ': : \"i\" ((long int) (%s)));'

>                           % (name, value))

>      out_lines.append('}')


Seems reasonable, thanks.

Florian
Andreas Schwab Oct. 19, 2021, 7:44 a.m. | #4
On Okt 07 2021, Fangrui Song via Libc-alpha wrote:

> Unlike GCC, Clang passes asm statements and verifies they are valid


parses

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

Patch

diff --git a/scripts/glibcextract.py b/scripts/glibcextract.py
index 752ff6223b..bf49a5e322 100644
--- a/scripts/glibcextract.py
+++ b/scripts/glibcextract.py
@@ -45,7 +45,7 @@  def compute_c_consts(sym_data, cc):
             continue
         name = arg[0]
         value = arg[1]
-        out_lines.append('asm ("@@@name@@@%s@@@value@@@%%0@@@end@@@" '
+        out_lines.append('asm ("/* @@@name@@@%s@@@value@@@%%0@@@end@@@ */" '
                          ': : \"i\" ((long int) (%s)));'
                          % (name, value))
     out_lines.append('}')