Check __cplusplus in addition to _ISOMAC

Message ID 20170511141756.GA26086@intel.com
State New, archived
Headers

Commit Message

Lu, Hongjiu May 11, 2017, 2:17 p.m. UTC
  When compiling for C++, only include <wctype/wctype.h> and nothing else.

Any comments?

H.J.
---
	* include/wctype.h: Check __cplusplus in addition to _ISOMAC.
---
 include/wctype.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Zack Weinberg May 11, 2017, 2:28 p.m. UTC | #1
On Thu, May 11, 2017 at 10:17 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> When compiling for C++, only include <wctype/wctype.h> and nothing else.
>
> Any comments?

This is about to be superseded by the _ISOMAC-testsuite patch.  One of
its effects is to make __cplusplus imply _ISOMAC.  I plan to commit
that patch later today, unless an unexpected problem turns up in the
tests I'm running now.

zw
  

Patch

diff --git a/include/wctype.h b/include/wctype.h
index a71b103..74f9f47 100644
--- a/include/wctype.h
+++ b/include/wctype.h
@@ -1,6 +1,6 @@ 
 #ifndef _WCTYPE_H
 
-#ifndef _ISOMAC
+#if !defined _ISOMAC && !defined __cplusplus
 /* We try to get wint_t from <stddef.h>, but not all GCC versions define it
    there.  So define it ourselves if it remains undefined.  */
 # define __need_wint_t
@@ -38,7 +38,7 @@  libc_hidden_proto (towupper)
 
 #include <wctype/wctype.h>
 
-#ifndef _ISOMAC
+#if !defined _ISOMAC && !defined __cplusplus
 /* Internal interfaces.  */
 extern int __iswspace (wint_t __wc);
 extern int __iswctype (wint_t __wc, wctype_t __desc);