ctype: Make it usable in C++ code.
authorBruno Haible <bruno@clisp.org>
Sun, 7 Mar 2010 23:47:01 +0000 (00:47 +0100)
committerBruno Haible <bruno@clisp.org>
Mon, 8 Mar 2010 02:11:08 +0000 (03:11 +0100)
ChangeLog
lib/ctype.in.h
modules/ctype

index 9b5e5cc..7297b2a 100644 (file)
--- 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.
index c9b1063..ccf222d 100644 (file)
@@ -1,6 +1,6 @@
 /* A substitute for ISO C99 <ctype.h>, for platforms on which it is incomplete.
 
-   Copyright (C) 20092010 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
 #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
index 2cd1fb0..be01f0c 100644 (file)
@@ -7,6 +7,7 @@ m4/ctype.m4
 
 Depends-on:
 include_next
+c++defs
 warn-on-use
 
 configure.ac:
@@ -17,7 +18,7 @@ BUILT_SOURCES += ctype.h
 
 # 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 @@ ctype.h: ctype.in.h $(WARN_ON_USE_H)
              -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 && \