diff mbox series

[kvm-unit-tests,9/9] lib/linux/const.h: test for `__ASSEMBLER__` as well

Message ID 20230116175757.71059-10-mhartmay@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series Some cleanup patches | expand

Commit Message

Marc Hartmayer Jan. 16, 2023, 5:57 p.m. UTC
The macro `__ASSEMBLER__` is defined with value 1 when preprocessing
assembly language using gcc. [1] For s390x, we're using the preprocessor
for generating our linker scripts out of assembly file and therefore we
need this change.

[1] https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
---
 lib/linux/const.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Claudio Imbrenda Jan. 16, 2023, 6:25 p.m. UTC | #1
On Mon, 16 Jan 2023 18:57:57 +0100
Marc Hartmayer <mhartmay@linux.ibm.com> wrote:

> The macro `__ASSEMBLER__` is defined with value 1 when preprocessing
> assembly language using gcc. [1] For s390x, we're using the preprocessor
> for generating our linker scripts out of assembly file and therefore we
> need this change.
> 
> [1] https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html
> 
> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>

is this patch really needed? if so, why is it at the end of the series?

> ---
>  lib/linux/const.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/linux/const.h b/lib/linux/const.h
> index c872bfd25e13..be114dc4a553 100644
> --- a/lib/linux/const.h
> +++ b/lib/linux/const.h
> @@ -12,7 +12,7 @@
>   * leave it unchanged in asm.
>   */
>  
> -#ifdef __ASSEMBLY__
> +#if defined(__ASSEMBLY__) || defined(__ASSEMBLER__)
>  #define _AC(X,Y)	X
>  #define _AT(T,X)	X
>  #else
Marc Hartmayer Jan. 17, 2023, 9:39 a.m. UTC | #2
Claudio Imbrenda <imbrenda@linux.ibm.com> writes:

> On Mon, 16 Jan 2023 18:57:57 +0100
> Marc Hartmayer <mhartmay@linux.ibm.com> wrote:
>
>> The macro `__ASSEMBLER__` is defined with value 1 when preprocessing
>> assembly language using gcc. [1] For s390x, we're using the preprocessor
>> for generating our linker scripts out of assembly file and therefore we
>> need this change.
>> 
>> [1] https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html
>> 
>> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
>
> is this patch really needed? if so, why is it at the end of the
> series?

It was needed for some other patches… and for upcoming patches it is
(probably) required since otherwise we cannot use macros using the _AC
macro. So yep, it could be removed for now - and this was exactly the
reason why I put it at the end of the series.

Thanks for the feedback!

>
>> ---
>>  lib/linux/const.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/lib/linux/const.h b/lib/linux/const.h
>> index c872bfd25e13..be114dc4a553 100644
>> --- a/lib/linux/const.h
>> +++ b/lib/linux/const.h
>> @@ -12,7 +12,7 @@
>>   * leave it unchanged in asm.
>>   */
>>  
>> -#ifdef __ASSEMBLY__
>> +#if defined(__ASSEMBLY__) || defined(__ASSEMBLER__)
>>  #define _AC(X,Y)	X
>>  #define _AT(T,X)	X
>>  #else
>
Claudio Imbrenda Jan. 17, 2023, 10:28 a.m. UTC | #3
On Tue, 17 Jan 2023 10:39:58 +0100
Marc Hartmayer <mhartmay@linux.ibm.com> wrote:

> Claudio Imbrenda <imbrenda@linux.ibm.com> writes:
> 
> > On Mon, 16 Jan 2023 18:57:57 +0100
> > Marc Hartmayer <mhartmay@linux.ibm.com> wrote:
> >  
> >> The macro `__ASSEMBLER__` is defined with value 1 when preprocessing
> >> assembly language using gcc. [1] For s390x, we're using the preprocessor
> >> for generating our linker scripts out of assembly file and therefore we
> >> need this change.
> >> 
> >> [1] https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html
> >> 
> >> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>  
> >
> > is this patch really needed? if so, why is it at the end of the
> > series?  
> 
> It was needed for some other patches… and for upcoming patches it is
> (probably) required since otherwise we cannot use macros using the _AC
> macro. So yep, it could be removed for now - and this was exactly the
> reason why I put it at the end of the series.
> 
> Thanks for the feedback!

I don't see a problem adding this even if it's not used right now, but
in that case I want to know why you want to add it now :)

Just explain clearly in the patch description that this will be useful
in the future and why :)

> 
> >  
> >> ---
> >>  lib/linux/const.h | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >> 
> >> diff --git a/lib/linux/const.h b/lib/linux/const.h
> >> index c872bfd25e13..be114dc4a553 100644
> >> --- a/lib/linux/const.h
> >> +++ b/lib/linux/const.h
> >> @@ -12,7 +12,7 @@
> >>   * leave it unchanged in asm.
> >>   */
> >>  
> >> -#ifdef __ASSEMBLY__
> >> +#if defined(__ASSEMBLY__) || defined(__ASSEMBLER__)
> >>  #define _AC(X,Y)	X
> >>  #define _AT(T,X)	X
> >>  #else  
> >
diff mbox series

Patch

diff --git a/lib/linux/const.h b/lib/linux/const.h
index c872bfd25e13..be114dc4a553 100644
--- a/lib/linux/const.h
+++ b/lib/linux/const.h
@@ -12,7 +12,7 @@ 
  * leave it unchanged in asm.
  */
 
-#ifdef __ASSEMBLY__
+#if defined(__ASSEMBLY__) || defined(__ASSEMBLER__)
 #define _AC(X,Y)	X
 #define _AT(T,X)	X
 #else