Gcc: Difference between revisions

From miki
Jump to navigation Jump to search
m (Mip moved page GCC to Gcc)
 
Line 14: Line 14:
* <code>-Wshadow</code>
* <code>-Wshadow</code>
* <code>-Wformat=2</code>
* <code>-Wformat=2</code>

=== Get list of standard compiler defines ===
<source lang="bash">
gcc -dM -E -x c /dev/null
# #define __DBL_MIN_EXP__ (-1021)
# #define __FLT32X_MAX_EXP__ 1024
# #define __UINT_LEAST16_MAX__ 0xffff
# #define __ATOMIC_ACQUIRE 2
# #define __FLT128_MAX_10_EXP__ 4932
# ...
</source>

Latest revision as of 22:36, 9 February 2021

Tips

Enable more warnings

From [1]:

  • -Wduplicated-cond
  • -Wduplicated-branches
  • -Wlogical-op
  • -Wrestrict
  • -Wnull-dereference
  • -Wold-style-cast
  • -Wuseless-cast
  • -Wjump-misses-init
  • -Wdouble-promotion
  • -Wshadow
  • -Wformat=2

Get list of standard compiler defines

gcc -dM -E -x c /dev/null
# #define __DBL_MIN_EXP__ (-1021)
# #define __FLT32X_MAX_EXP__ 1024
# #define __UINT_LEAST16_MAX__ 0xffff
# #define __ATOMIC_ACQUIRE 2
# #define __FLT128_MAX_10_EXP__ 4932
# ...