Skip to content

Commit

Permalink
Detect if __func__ can be used with debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
wtoorop committed Feb 20, 2020
1 parent 4453feb commit dadddb0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,11 @@ if (HAVE_STRPTIME)
check_c_source_runs("${STRPTIME_TEST_SOURCE}" STRPTIME_WORKS)
endif ()

try_compile(HAVE___FUNC__
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/cmake/tests/test___func__.c
)

# TCP Fast Open.
if (NOT ENABLE_TCP_FAST_OPEN)
message(WARNING "TCP Fast Open disabled.")
Expand Down
2 changes: 2 additions & 0 deletions cmake/include/cmakeconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@
#cmakedefine HAVE_TARGET_ENDIANNESS
#cmakedefine TARGET_IS_BIG_ENDIAN

#cmakedefine HAVE___FUNC__ 1

#ifdef HAVE___FUNC__
#define __FUNC__ __func__
#else
Expand Down
4 changes: 4 additions & 0 deletions cmake/tests/test___func__.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
int main (int ac, char *av[])
{
char *s = __func__;
}

0 comments on commit dadddb0

Please sign in to comment.