Skip to content

Commit

Permalink
cgen: fix the logic around the definition of VNORETURN and VUNREACHAB…
Browse files Browse the repository at this point in the history
…LE (less warnings on FreeBSD) (#19316)
  • Loading branch information
kimshrier committed Sep 10, 2023
1 parent 7661b5a commit 9145869
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions vlib/v/gen/c/cheaders.v
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ const c_common_macros = '
#endif
# if !defined(__TINYC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
# define VNORETURN _Noreturn
# elif defined(__GNUC__) && __GNUC__ >= 2
# elif !defined(VNORETURN) && defined(__GNUC__) && __GNUC__ >= 2
# define VNORETURN __attribute__((noreturn))
# endif
#ifndef VNORETURN
Expand All @@ -446,21 +446,18 @@ const c_common_macros = '
#if !defined(VUNREACHABLE)
#if defined(__GNUC__) && !defined(__clang__)
#define V_GCC_VERSION (__GNUC__ * 10000L + __GNUC_MINOR__ * 100L + __GNUC_PATCHLEVEL__)
#if (V_GCC_VERSION >= 40500L)
#if (V_GCC_VERSION >= 40500L) && !defined(__TINYC__)
#define VUNREACHABLE() do { __builtin_unreachable(); } while (0)
#endif
#endif
#if defined(__clang__) && defined(__has_builtin)
#if defined(__clang__) && defined(__has_builtin) && !defined(__TINYC__)
#if __has_builtin(__builtin_unreachable)
#define VUNREACHABLE() do { __builtin_unreachable(); } while (0)
#endif
#endif
#ifndef VUNREACHABLE
#define VUNREACHABLE() do { } while (0)
#endif
#if defined(__FreeBSD__) && defined(__TINYC__)
#define VUNREACHABLE() do { } while (0)
#endif
#endif
//likely and unlikely macros
Expand Down

0 comments on commit 9145869

Please sign in to comment.