Skip to content

Commit

Permalink
use __func__ instead of __FUNCTION__
Browse files Browse the repository at this point in the history
__FUNCTION__ is a non-standard extension while __func__ is C99.
  • Loading branch information
Josef 'Jeff' Sipek authored and GitLab committed Nov 2, 2016
1 parent e1d4f6f commit 4ab8814
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
6 changes: 1 addition & 5 deletions src/lib/data-stack.h
Expand Up @@ -61,13 +61,9 @@ void t_pop_last_unsafe(void);
#ifndef DEBUG
#define T_BEGIN \
STMT_START { data_stack_frame_t _data_stack_cur_id = t_push(NULL);
#elif defined (__GNUC__) && !defined (__STRICT_ANSI__)
#define T_BEGIN \
STMT_START { data_stack_frame_t _data_stack_cur_id = t_push(__FUNCTION__);
#else
#define T_CAT2(a,b) (a ":" #b)
#define T_BEGIN \
STMT_START { data_stack_frame_t _data_stack_cur_id = t_push(T_CAT2(__FILE__,__LINE__));
STMT_START { data_stack_frame_t _data_stack_cur_id = t_push(__func__);
#endif
#define T_END \
STMT_START { \
Expand Down
13 changes: 2 additions & 11 deletions src/lib/macros.h
Expand Up @@ -187,25 +187,16 @@
/* Provide macros for error handling. */
#ifdef DISABLE_ASSERTS
# define i_assert(expr)
#elif defined (__GNUC__) && !defined (__STRICT_ANSI__)
#else

#define i_assert(expr) STMT_START{ \
if (unlikely(!(expr))) \
i_panic("file %s: line %d (%s): assertion failed: (%s)", \
__FILE__, \
__LINE__, \
__FUNCTION__, \
__func__, \
#expr); }STMT_END

#else /* !__GNUC__ */

#define i_assert(expr) STMT_START{ \
if (unlikely(!(expr))) \
i_panic("file %s: line %d: assertion failed: (%s)", \
__FILE__, \
__LINE__, \
#expr); }STMT_END

#endif

#define i_close_fd(fd) STMT_START { \
Expand Down

0 comments on commit 4ab8814

Please sign in to comment.