Determine optimization level in preprocessor?

后端 未结 2 1336
甜味超标
甜味超标 2020-12-17 09:10

-Og is a relatively new optimization option that is intended to improve the debugging experience while apply optimizations. If a user selects -Og,

2条回答
  •  孤城傲影
    2020-12-17 09:23

    I don't know if this is clever hack, but it is a hack.

    $ gcc -Xpreprocessor -dM -E - < /dev/null > 1
    $ gcc -Xpreprocessor -dM -O -E - < /dev/null > 2
    $ diff 1 2
    53a54
    > #define __OPTIMIZE__ 1
    68a70
    > #define _FORTIFY_SOURCE 2
    154d155
    < #define __NO_INLINE__ 1
    

    clang didn't produce the FORTIFY one.

提交回复
热议问题