From a0b977a430af88ff58d9596a60670936eb7f1d31 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 16 Jul 2004 16:28:48 +0000 Subject: [PATCH] Add extern "C" for C++. --- lib/ChangeLog | 13 +++++++++++++ lib/backupfile.h | 12 +++++++++++- lib/closeout.h | 10 +++++++++- lib/copy-file.h | 11 +++++++++++ lib/findprog.h | 11 +++++++++++ lib/full-write.h | 13 ++++++++++++- lib/pathname.h | 9 +++++++++ lib/progname.h | 14 +++++++++++++- lib/stpcpy.h | 8 ++++++++ lib/stpncpy.h | 14 +++++++++++++- lib/strcase.h | 12 ++++++++++++ lib/strstr.h | 10 +++++++++- lib/xalloc.h | 15 ++++++++++++++- 13 files changed, 145 insertions(+), 7 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index a77eb811e..2bd26abc8 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,5 +1,18 @@ 2004-07-16 Bruno Haible + * backupfile.h: Add extern "C" for C++. + * closeout.h: Likewise. + * copy-file.h: Likewise. + * findprog.h: Likewise. + * full-write.h: Likewise. + * pathname.h: Likewise. + * progname.h: Likewise. + * stpcpy.h: Likewise. + * stpncpy.h: Likewise. + * strcase.h: Likewise. + * strstr.h: Likewise. + * xalloc.h: Likewise. + * mbswidth.h: Add extern "C" for C++. Reported by Albert Chin-A-Young . diff --git a/lib/backupfile.h b/lib/backupfile.h index fe5e1deb3..346b60c3e 100644 --- a/lib/backupfile.h +++ b/lib/backupfile.h @@ -1,6 +1,6 @@ /* backupfile.h -- declarations for making Emacs style backup file names - Copyright (C) 1990, 1991, 1992, 1997, 1998, 1999, 2003 Free + Copyright (C) 1990, 1991, 1992, 1997, 1998, 1999, 2003, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -21,6 +21,11 @@ #ifndef BACKUPFILE_H_ # define BACKUPFILE_H_ +# ifdef __cplusplus +extern "C" { +# endif + + /* When to make backup files. */ enum backup_type { @@ -51,4 +56,9 @@ enum backup_type get_version (char const *context, char const *arg); enum backup_type xget_version (char const *context, char const *arg); void addext (char *, char const *, int); + +# ifdef __cplusplus +} +# endif + #endif /* ! BACKUPFILE_H_ */ diff --git a/lib/closeout.h b/lib/closeout.h index d27d7601e..1b715ee30 100644 --- a/lib/closeout.h +++ b/lib/closeout.h @@ -1,6 +1,6 @@ /* Close standard output. - Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc. + Copyright (C) 1998, 2000, 2003, 2004 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 @@ -19,7 +19,15 @@ #ifndef CLOSEOUT_H # define CLOSEOUT_H 1 +# ifdef __cplusplus +extern "C" { +# endif + void close_stdout_set_file_name (const char *file); void close_stdout (void); +# ifdef __cplusplus +} +# endif + #endif diff --git a/lib/copy-file.h b/lib/copy-file.h index 3efda34b8..bf5e9d8c1 100644 --- a/lib/copy-file.h +++ b/lib/copy-file.h @@ -16,9 +16,20 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef __cplusplus +extern "C" { +#endif + + /* Copy a regular file: from src_filename to dest_filename. The destination file is assumed to be a backup file. Modification times, owner, group and access permissions are preserved as far as possible. Exit upon failure. */ extern void copy_file_preserving (const char *src_filename, const char *dest_filename); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/findprog.h b/lib/findprog.h index 81a95b6dc..5913429f2 100644 --- a/lib/findprog.h +++ b/lib/findprog.h @@ -16,6 +16,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef __cplusplus +extern "C" { +#endif + + /* Look up a program in the PATH. Attempt to determine the pathname that would be called by execlp/execvp of PROGNAME. If successful, return a pathname containing a slash @@ -25,3 +31,8 @@ execl/execv on the returned pathname. The returned string is freshly malloc()ed if it is != PROGNAME. */ extern const char *find_in_path (const char *progname); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/full-write.h b/lib/full-write.h index 8cd2e8157..2637903ec 100644 --- a/lib/full-write.h +++ b/lib/full-write.h @@ -1,6 +1,6 @@ /* An interface to write() that writes all it is asked to write. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002-2003 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 @@ -18,7 +18,18 @@ #include + +#ifdef __cplusplus +extern "C" { +#endif + + /* Write COUNT bytes at BUF to descriptor FD, retrying if interrupted or if partial writes occur. Return the number of bytes successfully written, setting errno if that is less than COUNT. */ extern size_t full_write (int fd, const void *buf, size_t count); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/pathname.h b/lib/pathname.h index 75daa6594..1bce49bf7 100644 --- a/lib/pathname.h +++ b/lib/pathname.h @@ -18,6 +18,11 @@ #ifndef _PATHNAME_H #define _PATHNAME_H +#ifdef __cplusplus +extern "C" { +#endif + + /* Pathname support. ISSLASH(C) tests whether C is a directory separator character. IS_ABSOLUTE_PATH(P) tests whether P is an absolute path. If it is not, @@ -47,4 +52,8 @@ extern char *concatenated_pathname (const char *directory, const char *filename, const char *suffix); +#ifdef __cplusplus +} +#endif + #endif /* _PATHNAME_H */ diff --git a/lib/progname.h b/lib/progname.h index 89f0127c7..2088e0076 100644 --- a/lib/progname.h +++ b/lib/progname.h @@ -1,5 +1,5 @@ /* Program name management. - Copyright (C) 2001-2003 Free Software Foundation, Inc. + Copyright (C) 2001-2004 Free Software Foundation, Inc. Written by Bruno Haible , 2001. This program is free software; you can redistribute it and/or modify @@ -25,6 +25,12 @@ set_program_name (argv[0]); */ + +#ifdef __cplusplus +extern "C" { +#endif + + /* String containing name the program is called with. */ extern const char *program_name; @@ -47,4 +53,10 @@ extern char *get_full_program_name (void); #endif + +#ifdef __cplusplus +} +#endif + + #endif /* _PROGNAME_H */ diff --git a/lib/stpcpy.h b/lib/stpcpy.h index b579c5c9d..5e737cfd5 100644 --- a/lib/stpcpy.h +++ b/lib/stpcpy.h @@ -25,9 +25,17 @@ #else +#ifdef __cplusplus +extern "C" { +#endif + /* Copy SRC to DST, returning the address of the terminating '\0' in DST. */ extern char *stpcpy (char *dst, const char *src); +#ifdef __cplusplus +} +#endif + #endif #endif /* _STPCPY_H */ diff --git a/lib/stpncpy.h b/lib/stpncpy.h index cf658eb07..6dc92a813 100644 --- a/lib/stpncpy.h +++ b/lib/stpncpy.h @@ -1,5 +1,5 @@ /* String copying. - Copyright (C) 1995, 2001-2003 Free Software Foundation, Inc. + Copyright (C) 1995, 2001-2004 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 @@ -20,6 +20,12 @@ #include + +#ifdef __cplusplus +extern "C" { +#endif + + #if !HAVE_STPNCPY /* Copy no more than N bytes of SRC to DST, returning a pointer past the @@ -31,4 +37,10 @@ extern char *gnu_stpncpy (char *dst, const char *src, size_t n); #endif + +#ifdef __cplusplus +} +#endif + + #endif /* _STPNCPY_H */ diff --git a/lib/strcase.h b/lib/strcase.h index f17e64832..9461392f8 100644 --- a/lib/strcase.h +++ b/lib/strcase.h @@ -20,6 +20,12 @@ #include + +#ifdef __cplusplus +extern "C" { +#endif + + /* Compare strings S1 and S2, ignoring case, returning less than, equal to or greater than zero if S1 is lexicographically less than, equal to or greater than S2. @@ -32,4 +38,10 @@ extern int strcasecmp (const char *s1, const char *s2); Note: This function can not work correctly in multibyte locales. */ extern int strncasecmp (const char *s1, const char *s2, size_t n); + +#ifdef __cplusplus +} +#endif + + #endif /* _STRCASE_H */ diff --git a/lib/strstr.h b/lib/strstr.h index e424b8340..f244b9644 100644 --- a/lib/strstr.h +++ b/lib/strstr.h @@ -1,5 +1,5 @@ /* Searching in a string. - Copyright (C) 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 2001-2003 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 @@ -22,7 +22,15 @@ #else +#ifdef __cplusplus +extern "C" { +#endif + /* Find the first occurrence of NEEDLE in HAYSTACK. */ extern char *strstr (const char *haystack, const char *needle); +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/xalloc.h b/lib/xalloc.h index 4b6585811..5985892c9 100644 --- a/lib/xalloc.h +++ b/lib/xalloc.h @@ -1,7 +1,7 @@ /* xalloc.h -- malloc with out-of-memory checking Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2003 Free Software Foundation, Inc. + 1999, 2000, 2003, 2004 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 @@ -22,6 +22,12 @@ # include + +# ifdef __cplusplus +extern "C" { +# endif + + # ifndef __attribute__ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ # define __attribute__(x) @@ -32,6 +38,7 @@ # define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) # endif + /* If this pointer is non-zero, run the specified function upon each allocation failure. It is initialized to zero. */ extern void (*xalloc_fail_func) (void); @@ -84,4 +91,10 @@ char *xstrdup (const char *str); # define XREALLOC(p, type, n) xnrealloc (p, n, sizeof (type)) # define XFREE(p) free (p) + +# ifdef __cplusplus +} +# endif + + #endif /* !XALLOC_H_ */ -- 2.11.0