changeset 12929:c71f3c9363b0

ctype: Make it usable in C++ code.
author Bruno Haible <bruno@clisp.org>
date Mon, 08 Mar 2010 00:47:01 +0100
parents ab37e90dc2cd
children 8de7d7c428e7
files ChangeLog lib/ctype.in.h modules/ctype
diffstat 3 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2010-03-07  Bruno Haible  <bruno@clisp.org>
 
+	ctype: Make it usable in C++ code.
+	* lib/ctype.in.h: Include c++defs.h.
+	(isblank): Declare as extern "C".
+	* modules/ctype (Depends-on): Add c++defs.
+	(Makefile.am): Update ctype.h rule.
+
 	New module 'c++defs'.
 	* modules/c++defs: New file.
 	* build-aux/c++defs.h: New file.
--- a/lib/ctype.in.h
+++ b/lib/ctype.in.h
@@ -1,6 +1,6 @@
 /* A substitute for ISO C99 <ctype.h>, for platforms on which it is incomplete.
 
-   Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2009-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -36,12 +36,14 @@
 #ifndef _GL_CTYPE_H
 #define _GL_CTYPE_H
 
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
 /* The definition of _GL_WARN_ON_USE is copied here.  */
 
 /* Return non-zero if c is a blank, i.e. a space or tab character.  */
 #if @GNULIB_ISBLANK@
 # if !@HAVE_ISBLANK@
-extern int isblank (int c);
+_GL_EXTERN_C int isblank (int c);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef isblank
--- a/modules/ctype
+++ b/modules/ctype
@@ -7,6 +7,7 @@
 
 Depends-on:
 include_next
+c++defs
 warn-on-use
 
 configure.ac:
@@ -17,7 +18,7 @@
 
 # We need the following in order to create <ctype.h> when the system
 # doesn't have one that works with the given compiler.
-ctype.h: ctype.in.h $(WARN_ON_USE_H)
+ctype.h: ctype.in.h $(CXXDEFS_H) $(WARN_ON_USE_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -25,6 +26,7 @@
 	      -e 's|@''NEXT_CTYPE_H''@|$(NEXT_CTYPE_H)|g' \
 	      -e 's/@''GNULIB_ISBLANK''@/$(GNULIB_ISBLANK)/g' \
 	      -e 's/@''HAVE_ISBLANK''@/$(HAVE_ISBLANK)/g' \
+	      -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
 	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	      < $(srcdir)/ctype.in.h; \
 	} > $@-t && \