Browse Source

util: Add a NORETURN macro

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
tags/18.0-branchpoint
Jason Ekstrand 8 years ago
parent
commit
0c49aa0624
3 changed files with 11 additions and 0 deletions
  1. 1
    0
      configure.ac
  2. 4
    0
      meson.build
  3. 6
    0
      src/util/macros.h

+ 1
- 0
configure.ac View File

@@ -250,6 +250,7 @@ AX_GCC_FUNC_ATTRIBUTE([visibility])
AX_GCC_FUNC_ATTRIBUTE([warn_unused_result])
AX_GCC_FUNC_ATTRIBUTE([weak])
AX_GCC_FUNC_ATTRIBUTE([alias])
AX_GCC_FUNC_ATTRIBUTE([noreturn])

AM_CONDITIONAL([GEN_ASM_OFFSETS], test "x$GEN_ASM_OFFSETS" = xyes)


+ 4
- 0
meson.build View File

@@ -479,6 +479,10 @@ if cc.compiles('int foo(void) { return 0; } int bar(void) __attribute__((alias("
name : '__attribute__((alias(...)))')
pre_args += '-DHAVE_FUNC_ATTRIBUTE_ALIAS'
endif
if cc.compiles('int foo(void) __attribute__((__noreturn__));',
name : '__attribute__((__noreturn__))')
pre_args += '-DHAVE_FUNC_ATTRIBUTE_NORETURN'
endif

# TODO: this is very incomplete
if ['linux', 'cygwin'].contains(host_machine.system())

+ 6
- 0
src/util/macros.h View File

@@ -171,6 +171,12 @@ do { \
#define ATTRIBUTE_RETURNS_NONNULL
#endif

#ifdef HAVE_FUNC_ATTRIBUTE_NORETURN
#define NORETURN __attribute__((__noreturn__))
#else
#define NORETURN
#endif

#ifdef __cplusplus
/**
* Macro function that evaluates to true if T is a trivially

Loading…
Cancel
Save