Skip to content

Commit

Permalink
chore: detect compiler name and version
Browse files Browse the repository at this point in the history
  • Loading branch information
P403n1x87 committed Oct 4, 2023
1 parent 8d1f981 commit b031723
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
26 changes: 24 additions & 2 deletions src/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,42 @@
fprintf(pargs.output_file, __VA_ARGS__); \
NL;

#if defined __clang__
#define COMPILER "clang"
#define COMPILER_MAJOR __clang_major__
#define COMPILER_MINOR __clang_minor__
#define COMPILER_PATCH __clang_patchlevel__
#elif defined __MUSL__
#define COMPILER "musl-gcc"
#define COMPILER_MAJOR __GNUC__
#define COMPILER_MINOR __GNUC_MINOR__
#define COMPILER_PATCH __GNUC_PATCHLEVEL__
#elif defined __GNUC__
#define COMPILER "gcc"
#define COMPILER_MAJOR __GNUC__
#define COMPILER_MINOR __GNUC_MINOR__
#define COMPILER_PATCH __GNUC_PATCHLEVEL__
#elif defined _MSC_VER
#define COMPILER "msvc"
#define COMPILER_MAJOR _MSC_VER / 100
#define COMPILER_MINOR _MSC_VER % 100
#define COMPILER_PATCH _MSC_BUILD
#endif

#ifdef NATIVE
#define log_header() { \
log_m("\033[1m _ _ \033[0m"); \
log_m("\033[1m __ _ _ _ __| |_(_)_ _ \033[0m"); \
log_m("\033[1m/ _` | || (_-< _| | ' \\ \033[0m"); \
log_m("\033[1m\\__,_|\\_,_/__/\\__|_|_||_|\033[0m\033[31;1mp\033[0m \033[36;1m%s\033[0m [GCC %d.%d.%d]", VERSION, __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__); \
log_m("\033[1m\\__,_|\\_,_/__/\\__|_|_||_|\033[0m\033[31;1mp\033[0m \033[36;1m" VERSION "\033[0m [" COMPILER " %d.%d.%d]", COMPILER_MAJOR, COMPILER_MINOR, COMPILER_PATCH); \
log_i("====[ AUSTINP ]===="); \
}
#else
#define log_header() { \
log_m("\033[1m _ _ \033[0m "); \
log_m("\033[1m __ _ _ _ __| |_(_)_ _ \033[0m"); \
log_m("\033[1m/ _` | || (_-< _| | ' \\ \033[0m"); \
log_m("\033[1m\\__,_|\\_,_/__/\\__|_|_||_|\033[0m \033[36;1m%s\033[0m [GCC %d.%d.%d]", VERSION, __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__); \
log_m("\033[1m\\__,_|\\_,_/__/\\__|_|_||_|\033[0m \033[36;1m" VERSION "\033[0m [" COMPILER " %d.%d.%d]", COMPILER_MAJOR, COMPILER_MINOR, COMPILER_PATCH); \
log_i("====[ AUSTIN ]===="); \
}
#endif
Expand Down
1 change: 0 additions & 1 deletion test/functional/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def test_cli_short_lived():

def test_cli_invalid_command():
result = austin("snafubar", expect_fail=33)
assert "[GCC" in result.stderr
assert result.returncode == 33
assert "Cannot launch" in (result.stderr or result.stdout)

Expand Down

0 comments on commit b031723

Please sign in to comment.