Linux Macros: __assembly__

Source: Internet
Author: User

Compilation: assembly

Guess: So this macro is related to the assembly?!

Reference: Some of the constant macros are referenced by both C and ASM, while C and ASM differ in the processing of the immediate number symbol . In ASM, directives are adopted to differentiate whether the operands are signed or unsigned, rather than through the operands. and C is through the property of the variable, not through the operator. c If you want to indicate that a constant is unsigned, you must add a suffix to the constant, and ASM is indicated by using a different directive. Thus, when a constant is contained by both C and ASM, different processing must be done. So Kbuild_aflags will add an d__assembly__ to tell the preprocessor that this is ASM.

/*linux-3.08/include/linux/const.h*//*Const.h:macros for dealing with constants. */#ifndef _linux_const_h#define_linux_const_h/*Some constant macros is used in both assembler and * C code.  Therefore We cannot annotate them always with * ' UL ' and other type specifiers unilaterally. We * Use the following macros to deal with this. * * Similarly, _at () would cast an expression with a type in C, but * leave it unchanged in ASM. */
/*
* The note above says: Some of the constant macros are used in both assembly and C, however, we cannot add a "UL" or other suffix as the macro constants of note C. So we need to use the following macro to solve this problem.
* For example call: #define DEMO_MACRO _at (1, UL): In C will be interpreted as #define DEMO_MACRO 1UL, and in the Assembly do nothing, that is: #define DEMO_MACRO 1
*/
#ifdef __assembly__#define_ac (x, y) X#define_at (t,x) X#else#define__ac (x, y) (x# #Y)#define_ac (x, y) __ac (x, y)#define_at (T,x) ((T) (X))#endif#endif/* ! (_linux_const_h) */

Linux Macros: __assembly__

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.