Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/sys/sys Pull up following revision(s) (requested by kamil...



details:   https://anonhg.NetBSD.org/src/rev/ff5c4709b474
branches:  netbsd-8
changeset: 449309:ff5c4709b474
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Mar 03 11:10:16 2019 +0000

description:
Pull up following revision(s) (requested by kamil in ticket #1202):

        sys/sys/cdefs.h: revision 1.138

Stop mangling __func__ for C++11 and newer

Drop local logic between GCC 2.4 and GCC 2.6 that used __PRETTY_FUNCTION__.

This caused __func__ to be redefined for all C++ programs and use a
different behavior than intended by the compiler (Clang and GCC).
__PRETTY_FUNCTION__ prints all the prototype not just function name,
contrary to __FUNCTION__ and __func__.

__func__ is now an integral part of C99 and C++11, shipped by a compiler.
This change aligns the behavior of C++ programs using __func__ to other
Operating Systems. The difference caused unnecessary fallout in regression
test suites in projects (LLVM, fish, ...).

diffstat:

 sys/sys/cdefs.h |  14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diffs (33 lines):

diff -r 338613941109 -r ff5c4709b474 sys/sys/cdefs.h
--- a/sys/sys/cdefs.h   Sun Mar 03 11:01:48 2019 +0000
+++ b/sys/sys/cdefs.h   Sun Mar 03 11:10:16 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cdefs.h,v 1.132.6.1 2018/01/13 21:33:14 snj Exp $      */
+/*     $NetBSD: cdefs.h,v 1.132.6.2 2019/03/03 11:10:16 martin Exp $   */
 
 /* * Copyright (c) 1991, 1993
  *     The Regents of the University of California.  All rights reserved.
@@ -405,18 +405,16 @@
 #endif
 
 /*
- * C99 defines __func__ predefined identifier, which was made available
- * in GCC 2.95.
+ * C99 and C++11 define __func__ predefined identifier, which was made
+ * available in GCC 2.95.
  */
-#if !(__STDC_VERSION__ >= 199901L)
-#if __GNUC_PREREQ__(2, 6)
-#define        __func__        __PRETTY_FUNCTION__
-#elif __GNUC_PREREQ__(2, 4)
+#if !(__STDC_VERSION__ >= 199901L) && !(__cplusplus - 0 >= 201103L)
+#if __GNUC_PREREQ__(2, 4)
 #define        __func__        __FUNCTION__
 #else
 #define        __func__        ""
 #endif
-#endif /* !(__STDC_VERSION__ >= 199901L) */
+#endif /* !(__STDC_VERSION__ >= 199901L) && !(__cplusplus - 0 >= 201103L) */
 
 #if defined(_KERNEL)
 #if defined(NO_KERNEL_RCSIDS)



Home | Main Index | Thread Index | Old Index