Gcc

From miki
Revision as of 22:36, 9 February 2021 by Mip (talk | contribs) (→‎Tips)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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
# ...