Clang

From miki
Revision as of 23:13, 17 November 2019 by Mip (talk | contribs) (→‎Tips)
Jump to navigation Jump to search

Links

Clang on Windows

The best port of LLVM/Clang on Windows I tried. Does not require Visual Studio for linking. Support UBSAN (at least 64-bit target).
  • MSYS2
MSYS2 now provides clang 9.0 packages. No deps on VS but they don't provide UBSAN apparently.

Tips

Get Stack Pointer

Use this macro [1]:

#define current_stack_pointer ({ \
        register unsigned long esp asm("esp"); \
        asm("" : "=r"(esp)); \
        esp; \
        })

Turn errors into warning

From the manual

-Wno-error=foo Turn warning “foo” into an warning even if -Werror is specified.

Enable all warnings: -Weverything

-Weverything means enable all current and future warnings. See Better Apps with Clang's Weverything or Wall is a Lie!