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

Message ID 20211008014014.800723-1-maskray@google.com
State Committed
Commit 46baeb61e16511f26db1b255e19dc9163f590367
Headers
Series glibcextract.py: Place un-assemblable @@@ in a comment |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

Fangrui Song Oct. 8, 2021, 1:40 a.m. UTC
  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(-)
  

Comments

Fangrui Song Oct. 15, 2021, 4:29 p.m. UTC | #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..
  
Fangrui Song Oct. 19, 2021, 6:18 a.m. UTC | #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.
  
Florian Weimer Oct. 19, 2021, 7:40 a.m. UTC | #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. UTC | #4
On Okt 07 2021, Fangrui Song via Libc-alpha wrote:

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

parses

Andreas.
  

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('}')