From 32a0b508a380272d7b044a0fd566fcdfb37376a6 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 18 Apr 2024 00:28:40 +0200 Subject: [PATCH 1/2] Fix linkage errors when using C++. Reported by Miro Palmu in . * lib/acl.h: Add 'extern "C" {' / '}' boilerplate. * lib/alignalloc.h: Likewise. * lib/aligned-malloc.h: Likewise. * lib/allocator.h: Likewise. * lib/arcfour.h: Likewise. * lib/arctwo.h: Likewise. * lib/areadlink.h: Likewise. * lib/argv-iter.h: Likewise. * lib/argz.in.h: Likewise. * lib/binary-io.h: Likewise. * lib/bitrotate.h: Likewise. * lib/bitset.h: Likewise. * lib/bitsetv.h: Likewise. * lib/c-strcaseeq.h: Likewise. * lib/canon-host.h: Likewise. * lib/careadlinkat.h: Likewise. * lib/chdir-long.h: Likewise. * lib/check-version.h: Likewise. * lib/classpath.h: Likewise. * lib/cloexec.h: Likewise. * lib/close-stream.h: Likewise. * lib/crc.h: Likewise. * lib/csharpcomp.h: Likewise. * lib/csharpexec.h: Likewise. * lib/cycle-check.h: Likewise. * lib/des.h: Likewise. * lib/dev-ino.h: Likewise. * lib/di-set.h: Likewise. * lib/eealloc.h: Likewise. * lib/exclude.h: Likewise. * lib/execinfo.in.h: Likewise. * lib/execute.h: Likewise. * lib/exitfail.h: Likewise. * lib/fcntl-safer.h: Likewise. * lib/file-set.h: Likewise. * lib/file-type.h: Likewise. * lib/filenamecat.h: Likewise. * lib/filevercmp.h: Likewise. * lib/fpending.h: Likewise. * lib/fprintftime.h: Likewise. * lib/fpucw.h: Likewise. * lib/fsusage.h: Likewise. * lib/ftoastr.h: Likewise. * lib/full-read.h: Likewise. * lib/gc.h: Likewise. * lib/getndelim2.h: Likewise. * lib/getnline.h: Likewise. * lib/getugroups.h: Likewise. * lib/glthread/tls.h: Likewise. * lib/hamt.h: Likewise. * lib/hard-locale.h: Likewise. * lib/hash-pjw-bare.h: Likewise. * lib/hash-pjw.h: Likewise. * lib/hash-triple.h: Likewise. * lib/hmac.h: Likewise. * lib/human.h: Likewise. * lib/i-ring.h: Likewise. * lib/idcache.h: Likewise. * lib/idx.h: Likewise. * lib/ino-map.h: Likewise. * lib/inttostr.h: Likewise. * lib/isapipe.h: Likewise. * lib/javacomp.h: Likewise. * lib/javaexec.h: Likewise. * lib/jit/cache.h: Likewise. * lib/linebuffer.h: Likewise. * lib/localeinfo.h: Likewise. * lib/long-options.h: Likewise. * lib/mbchar.h: Likewise. * lib/mbfile.h: Likewise. * lib/mbiter.h: Likewise. * lib/mbiterf.h: Likewise. * lib/mbuiter.h: Likewise. * lib/mbuiterf.h: Likewise. * lib/mcel.h: Likewise. * lib/memcasecmp.h: Likewise. * lib/memcoll.h: Likewise. * lib/memxor.h: Likewise. * lib/mgetgroups.h: Likewise. * lib/mkdir-p.h: Likewise. * lib/modechange.h: Likewise. * lib/mountlist.h: Likewise. * lib/mpsort.h: Likewise. * lib/msvc-nothrow.h: Likewise. * lib/nan.h: Likewise. * lib/openat-priv.h: Likewise. * lib/openat.h: Likewise. * lib/opendirat.h: Likewise. * lib/pagealign_alloc.h: Likewise. * lib/parse-datetime.h: Likewise. * lib/parse-duration.h: Likewise. * lib/physmem.h: Likewise. * lib/posixtm.h: Likewise. * lib/posixver.h: Likewise. * lib/printf-frexp.h: Likewise. * lib/printf-frexpl.h: Likewise. * lib/priv-set.h: Likewise. * lib/quote.h: Likewise. * lib/quotearg.h: Likewise. * lib/read-file.h: Likewise. * lib/readline.h: Likewise. * lib/readtokens.h: Likewise. * lib/readtokens0.h: Likewise. * lib/regex-quote.h: Likewise. * lib/renameatu.h: Likewise. * lib/rijndael-alg-fst.h: Likewise. * lib/rijndael-api-fst.h: Likewise. * lib/safe-alloc.h: Likewise. * lib/safe-write.h: Likewise. * lib/same-inode.h: Likewise. * lib/same.h: Likewise. * lib/save-cwd.h: Likewise. * lib/savedir.h: Likewise. * lib/savewd.h: Likewise. * lib/selinux-at.h: Likewise. * lib/signed-nan.h: Likewise. * lib/signed-snan.h: Likewise. * lib/snan.h: Likewise. * lib/sockets.h: Likewise. * lib/stdio-safer.h: Likewise. * lib/stdlib-safer.h: Likewise. * lib/streq.h: Likewise. * lib/strerror-override.h: Likewise. * lib/tmpdir.h: Likewise. * lib/trim.h: Likewise. * lib/u64.h: Likewise. * lib/unicase/casefold.h: Likewise. * lib/unicase/caseprop.h: Likewise. * lib/unicase/invariant.h: Likewise. * lib/unicase/special-casing.in.h: Likewise. * lib/unicase/unicasemap.h: Likewise. * lib/unicodeio.h: Likewise. * lib/unilbrk/lbrktables.h: Likewise. * lib/unilbrk/ulc-common.h: Likewise. * lib/uninorm/decompose-internal.h: Likewise. * lib/unistd-safer.h: Likewise. * lib/unitypes.in.h: Likewise. * lib/uniwbrk/wbrktable.h: Likewise. * lib/unlinkdir.h: Likewise. * lib/userspec.h: Likewise. * lib/utimecmp.h: Likewise. * lib/utimens.h: Likewise. * lib/windows-spawn.h: Likewise. * lib/write-any-file.h: Likewise. * lib/xbinary-io.h: Likewise. * lib/xgetcwd.h: Likewise. * lib/xgetdomainname.h: Likewise. * lib/xgethostname.h: Likewise. * lib/xmemcoll.h: Likewise. * lib/xprintf.h: Likewise. * lib/xreadlink.h: Likewise. * lib/xsize.h: Likewise. * lib/xstrndup.h: Likewise. * lib/xstrtod.h: Likewise. * lib/xstrtol.h: Likewise. * lib/yesno.h: Likewise. * lib/isnand-nolibm.h (isnand): Declare with C linkage. * lib/isnanf-nolibm.h (isnanf): Likewise. * lib/isnanl-nolibm.h (isnanl): Likewise. --- ChangeLog | 165 +++++++++++++++++++++++++++++++ lib/acl.h | 10 ++ lib/alignalloc.h | 10 ++ lib/aligned-malloc.h | 10 ++ lib/allocator.h | 10 ++ lib/arcfour.h | 16 ++- lib/arctwo.h | 16 ++- lib/areadlink.h | 10 ++ lib/argv-iter.h | 10 ++ lib/argz.in.h | 9 ++ lib/binary-io.h | 10 ++ lib/bitrotate.h | 10 ++ lib/bitset.h | 10 ++ lib/bitsetv.h | 10 ++ lib/c-strcaseeq.h | 10 ++ lib/canon-host.h | 22 +++-- lib/careadlinkat.h | 10 ++ lib/chdir-long.h | 10 ++ lib/check-version.h | 10 ++ lib/classpath.h | 10 ++ lib/cloexec.h | 10 ++ lib/close-stream.h | 10 ++ lib/crc.h | 12 ++- lib/csharpcomp.h | 10 ++ lib/csharpexec.h | 10 ++ lib/cycle-check.h | 20 +++- lib/des.h | 12 ++- lib/dev-ino.h | 16 ++- lib/di-set.h | 20 +++- lib/eealloc.h | 10 ++ lib/exclude.h | 14 ++- lib/execinfo.in.h | 10 ++ lib/execute.h | 10 ++ lib/exitfail.h | 10 ++ lib/fcntl-safer.h | 10 ++ lib/file-set.h | 10 ++ lib/file-type.h | 22 +++-- lib/filenamecat.h | 10 ++ lib/filevercmp.h | 10 ++ lib/fpending.h | 10 ++ lib/fprintftime.h | 10 ++ lib/fpucw.h | 10 ++ lib/fsusage.h | 14 ++- lib/ftoastr.h | 10 ++ lib/full-read.h | 10 ++ lib/gc.h | 20 +++- lib/getndelim2.h | 10 ++ lib/getnline.h | 10 ++ lib/getugroups.h | 11 +++ lib/glthread/tls.h | 32 ++++++ lib/hamt.h | 10 ++ lib/hard-locale.h | 12 ++- lib/hash-pjw-bare.h | 10 ++ lib/hash-pjw.h | 10 ++ lib/hash-triple.h | 10 ++ lib/hmac.h | 12 ++- lib/human.h | 22 +++-- lib/i-ring.h | 10 ++ lib/idcache.h | 14 ++- lib/idx.h | 10 ++ lib/ino-map.h | 22 +++-- lib/inttostr.h | 10 ++ lib/isapipe.h | 10 ++ lib/isnand-nolibm.h | 6 +- lib/isnanf-nolibm.h | 12 ++- lib/isnanl-nolibm.h | 6 +- lib/javacomp.h | 10 ++ lib/javaexec.h | 10 ++ lib/jit/cache.h | 10 ++ lib/linebuffer.h | 16 ++- lib/localeinfo.h | 10 ++ lib/long-options.h | 10 ++ lib/mbchar.h | 10 ++ lib/mbfile.h | 10 ++ lib/mbiter.h | 10 ++ lib/mbiterf.h | 10 ++ lib/mbuiter.h | 10 ++ lib/mbuiterf.h | 10 ++ lib/mcel.h | 20 +++- lib/memcasecmp.h | 10 ++ lib/memcoll.h | 14 ++- lib/memxor.h | 12 ++- lib/mgetgroups.h | 10 ++ lib/mkdir-p.h | 10 ++ lib/modechange.h | 22 +++-- lib/mountlist.h | 20 +++- lib/mpsort.h | 10 ++ lib/msvc-nothrow.h | 8 ++ lib/nan.h | 10 +- lib/openat-priv.h | 10 ++ lib/openat.h | 10 ++ lib/opendirat.h | 10 ++ lib/pagealign_alloc.h | 20 +++- lib/parse-datetime.h | 10 ++ lib/parse-duration.h | 10 ++ lib/physmem.h | 10 ++ lib/posixtm.h | 24 +++-- lib/posixver.h | 10 ++ lib/printf-frexp.h | 10 ++ lib/printf-frexpl.h | 10 ++ lib/priv-set.h | 10 ++ lib/quote.h | 14 ++- lib/quotearg.h | 26 +++-- lib/read-file.h | 10 ++ lib/readline.h | 10 ++ lib/readtokens.h | 10 ++ lib/readtokens0.h | 18 +++- lib/regex-quote.h | 9 ++ lib/renameatu.h | 11 +++ lib/rijndael-alg-fst.h | 10 ++ lib/rijndael-api-fst.h | 10 ++ lib/safe-alloc.h | 10 ++ lib/safe-write.h | 10 ++ lib/same-inode.h | 10 ++ lib/same.h | 12 ++- lib/save-cwd.h | 12 ++- lib/savedir.h | 10 ++ lib/savewd.h | 10 ++ lib/selinux-at.h | 10 ++ lib/signed-nan.h | 8 ++ lib/signed-snan.h | 8 ++ lib/snan.h | 8 ++ lib/sockets.h | 9 ++ lib/stdio-safer.h | 10 ++ lib/stdlib-safer.h | 10 ++ lib/streq.h | 10 ++ lib/strerror-override.h | 72 ++++++++------ lib/tmpdir.h | 10 ++ lib/trim.h | 10 ++ lib/u64.h | 10 ++ lib/unicase/casefold.h | 10 ++ lib/unicase/caseprop.h | 10 ++ lib/unicase/invariant.h | 10 ++ lib/unicase/special-casing.in.h | 10 ++ lib/unicase/unicasemap.h | 10 ++ lib/unicodeio.h | 16 ++- lib/unilbrk/lbrktables.h | 10 ++ lib/unilbrk/ulc-common.h | 10 ++ lib/uninorm/decompose-internal.h | 10 ++ lib/unistd-safer.h | 10 ++ lib/unitypes.in.h | 10 ++ lib/uniwbrk/wbrktable.h | 8 ++ lib/unlinkdir.h | 8 ++ lib/userspec.h | 14 ++- lib/utimecmp.h | 10 ++ lib/utimens.h | 19 ++++ lib/windows-spawn.h | 10 ++ lib/write-any-file.h | 10 ++ lib/xbinary-io.h | 10 ++ lib/xgetcwd.h | 10 ++ lib/xgetdomainname.h | 10 ++ lib/xgethostname.h | 10 ++ lib/xmemcoll.h | 10 ++ lib/xprintf.h | 10 ++ lib/xreadlink.h | 10 ++ lib/xsize.h | 10 ++ lib/xstrndup.h | 10 ++ lib/xstrtod.h | 12 ++- lib/xstrtol.h | 20 +++- lib/yesno.h | 10 ++ 160 files changed, 1912 insertions(+), 155 deletions(-) diff --git a/ChangeLog b/ChangeLog index 348c887be0..0890c3c43e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,168 @@ +2024-04-17 Bruno Haible + + Fix linkage errors when using C++. + Reported by Miro Palmu in + . + * lib/acl.h: Add 'extern "C" {' / '}' boilerplate. + * lib/alignalloc.h: Likewise. + * lib/aligned-malloc.h: Likewise. + * lib/allocator.h: Likewise. + * lib/arcfour.h: Likewise. + * lib/arctwo.h: Likewise. + * lib/areadlink.h: Likewise. + * lib/argv-iter.h: Likewise. + * lib/argz.in.h: Likewise. + * lib/binary-io.h: Likewise. + * lib/bitrotate.h: Likewise. + * lib/bitset.h: Likewise. + * lib/bitsetv.h: Likewise. + * lib/c-strcaseeq.h: Likewise. + * lib/canon-host.h: Likewise. + * lib/careadlinkat.h: Likewise. + * lib/chdir-long.h: Likewise. + * lib/check-version.h: Likewise. + * lib/classpath.h: Likewise. + * lib/cloexec.h: Likewise. + * lib/close-stream.h: Likewise. + * lib/crc.h: Likewise. + * lib/csharpcomp.h: Likewise. + * lib/csharpexec.h: Likewise. + * lib/cycle-check.h: Likewise. + * lib/des.h: Likewise. + * lib/dev-ino.h: Likewise. + * lib/di-set.h: Likewise. + * lib/eealloc.h: Likewise. + * lib/exclude.h: Likewise. + * lib/execinfo.in.h: Likewise. + * lib/execute.h: Likewise. + * lib/exitfail.h: Likewise. + * lib/fcntl-safer.h: Likewise. + * lib/file-set.h: Likewise. + * lib/file-type.h: Likewise. + * lib/filenamecat.h: Likewise. + * lib/filevercmp.h: Likewise. + * lib/fpending.h: Likewise. + * lib/fprintftime.h: Likewise. + * lib/fpucw.h: Likewise. + * lib/fsusage.h: Likewise. + * lib/ftoastr.h: Likewise. + * lib/full-read.h: Likewise. + * lib/gc.h: Likewise. + * lib/getndelim2.h: Likewise. + * lib/getnline.h: Likewise. + * lib/getugroups.h: Likewise. + * lib/glthread/tls.h: Likewise. + * lib/hamt.h: Likewise. + * lib/hard-locale.h: Likewise. + * lib/hash-pjw-bare.h: Likewise. + * lib/hash-pjw.h: Likewise. + * lib/hash-triple.h: Likewise. + * lib/hmac.h: Likewise. + * lib/human.h: Likewise. + * lib/i-ring.h: Likewise. + * lib/idcache.h: Likewise. + * lib/idx.h: Likewise. + * lib/ino-map.h: Likewise. + * lib/inttostr.h: Likewise. + * lib/isapipe.h: Likewise. + * lib/javacomp.h: Likewise. + * lib/javaexec.h: Likewise. + * lib/jit/cache.h: Likewise. + * lib/linebuffer.h: Likewise. + * lib/localeinfo.h: Likewise. + * lib/long-options.h: Likewise. + * lib/mbchar.h: Likewise. + * lib/mbfile.h: Likewise. + * lib/mbiter.h: Likewise. + * lib/mbiterf.h: Likewise. + * lib/mbuiter.h: Likewise. + * lib/mbuiterf.h: Likewise. + * lib/mcel.h: Likewise. + * lib/memcasecmp.h: Likewise. + * lib/memcoll.h: Likewise. + * lib/memxor.h: Likewise. + * lib/mgetgroups.h: Likewise. + * lib/mkdir-p.h: Likewise. + * lib/modechange.h: Likewise. + * lib/mountlist.h: Likewise. + * lib/mpsort.h: Likewise. + * lib/msvc-nothrow.h: Likewise. + * lib/nan.h: Likewise. + * lib/openat-priv.h: Likewise. + * lib/openat.h: Likewise. + * lib/opendirat.h: Likewise. + * lib/pagealign_alloc.h: Likewise. + * lib/parse-datetime.h: Likewise. + * lib/parse-duration.h: Likewise. + * lib/physmem.h: Likewise. + * lib/posixtm.h: Likewise. + * lib/posixver.h: Likewise. + * lib/printf-frexp.h: Likewise. + * lib/printf-frexpl.h: Likewise. + * lib/priv-set.h: Likewise. + * lib/quote.h: Likewise. + * lib/quotearg.h: Likewise. + * lib/read-file.h: Likewise. + * lib/readline.h: Likewise. + * lib/readtokens.h: Likewise. + * lib/readtokens0.h: Likewise. + * lib/regex-quote.h: Likewise. + * lib/renameatu.h: Likewise. + * lib/rijndael-alg-fst.h: Likewise. + * lib/rijndael-api-fst.h: Likewise. + * lib/safe-alloc.h: Likewise. + * lib/safe-write.h: Likewise. + * lib/same-inode.h: Likewise. + * lib/same.h: Likewise. + * lib/save-cwd.h: Likewise. + * lib/savedir.h: Likewise. + * lib/savewd.h: Likewise. + * lib/selinux-at.h: Likewise. + * lib/signed-nan.h: Likewise. + * lib/signed-snan.h: Likewise. + * lib/snan.h: Likewise. + * lib/sockets.h: Likewise. + * lib/stdio-safer.h: Likewise. + * lib/stdlib-safer.h: Likewise. + * lib/streq.h: Likewise. + * lib/strerror-override.h: Likewise. + * lib/tmpdir.h: Likewise. + * lib/trim.h: Likewise. + * lib/u64.h: Likewise. + * lib/unicase/casefold.h: Likewise. + * lib/unicase/caseprop.h: Likewise. + * lib/unicase/invariant.h: Likewise. + * lib/unicase/special-casing.in.h: Likewise. + * lib/unicase/unicasemap.h: Likewise. + * lib/unicodeio.h: Likewise. + * lib/unilbrk/lbrktables.h: Likewise. + * lib/unilbrk/ulc-common.h: Likewise. + * lib/uninorm/decompose-internal.h: Likewise. + * lib/unistd-safer.h: Likewise. + * lib/unitypes.in.h: Likewise. + * lib/uniwbrk/wbrktable.h: Likewise. + * lib/unlinkdir.h: Likewise. + * lib/userspec.h: Likewise. + * lib/utimecmp.h: Likewise. + * lib/utimens.h: Likewise. + * lib/windows-spawn.h: Likewise. + * lib/write-any-file.h: Likewise. + * lib/xbinary-io.h: Likewise. + * lib/xgetcwd.h: Likewise. + * lib/xgetdomainname.h: Likewise. + * lib/xgethostname.h: Likewise. + * lib/xmemcoll.h: Likewise. + * lib/xprintf.h: Likewise. + * lib/xreadlink.h: Likewise. + * lib/xsize.h: Likewise. + * lib/xstrndup.h: Likewise. + * lib/xstrtod.h: Likewise. + * lib/xstrtol.h: Likewise. + * lib/yesno.h: Likewise. + * lib/isnand-nolibm.h (isnand): Declare with C linkage. + * lib/isnanf-nolibm.h (isnanf): Likewise. + * lib/isnanl-nolibm.h (isnanl): Likewise. + 2024-04-17 Collin Funk gnulib-tool.py: Make an instance variable local to a function. diff --git a/lib/acl.h b/lib/acl.h index a3aeb8fc86..0bf78a654d 100644 --- a/lib/acl.h +++ b/lib/acl.h @@ -28,6 +28,11 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + + bool acl_errno_valid (int) _GL_ATTRIBUTE_CONST; int file_has_acl (char const *, struct stat const *); int qset_acl (char const *, int, mode_t); @@ -36,4 +41,9 @@ int qcopy_acl (char const *, int, char const *, int, mode_t); int copy_acl (char const *, int, char const *, int, mode_t); int chmod_or_fchmod (char const *, int, mode_t); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/alignalloc.h b/lib/alignalloc.h index d33f62e29c..0c73bfc4b2 100644 --- a/lib/alignalloc.h +++ b/lib/alignalloc.h @@ -38,6 +38,11 @@ _GL_INLINE_HEADER_BEGIN # define ALIGNALLOC_INLINE _GL_INLINE #endif +#ifdef __cplusplus +extern "C" { +#endif + + /* Whether aligned_alloc supports any power-of-two alignment, returns a nonnull pointer for size-zero allocations, and sets errno on failure. */ @@ -118,6 +123,11 @@ void *xalignalloc (idx_t, idx_t) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((2)) _GL_ATTRIBUTE_RETURNS_NONNULL /* _GL_ATTRIBUTE_DEALLOC (alignfree, 1) */; + +#ifdef __cplusplus +} +#endif + _GL_INLINE_HEADER_END #endif /* !ALIGNALLOC_H_ */ diff --git a/lib/aligned-malloc.h b/lib/aligned-malloc.h index a432512c76..d7142f5a8c 100644 --- a/lib/aligned-malloc.h +++ b/lib/aligned-malloc.h @@ -51,6 +51,11 @@ #error "Please include config.h first." #endif +#ifdef __cplusplus +extern "C" { +#endif + + #if !defined ALIGNMENT # error "ALIGNMENT is not defined" #endif @@ -185,3 +190,8 @@ aligned_malloc (size_t size) } #endif + + +#ifdef __cplusplus +} +#endif diff --git a/lib/allocator.h b/lib/allocator.h index bb30a3440c..53c8dfcacd 100644 --- a/lib/allocator.h +++ b/lib/allocator.h @@ -22,6 +22,11 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + /* An object describing a memory allocator family. */ struct allocator @@ -55,4 +60,9 @@ struct allocator /* An allocator using the stdlib functions and a null DIE function. */ extern struct allocator const stdlib_allocator; + +#ifdef __cplusplus +} +#endif + #endif /* _GL_ALLOCATOR_H */ diff --git a/lib/arcfour.h b/lib/arcfour.h index 742f4740f7..613a68c15f 100644 --- a/lib/arcfour.h +++ b/lib/arcfour.h @@ -19,10 +19,15 @@ /* Code from Libgcrypt adapted for gnulib by Simon Josefsson. */ #ifndef ARCFOUR_H -# define ARCFOUR_H +#define ARCFOUR_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif -# include -# include #define ARCFOUR_SBOX_SIZE 256 @@ -45,4 +50,9 @@ arcfour_stream (arcfour_context * context, extern void arcfour_setkey (arcfour_context * context, const char *key, size_t keylen); + +#ifdef __cplusplus +} +#endif + #endif /* ARCFOUR_H */ diff --git a/lib/arctwo.h b/lib/arctwo.h index 0dc0d8a934..27453c3c88 100644 --- a/lib/arctwo.h +++ b/lib/arctwo.h @@ -19,10 +19,15 @@ /* Code from Libgcrypt adapted for gnulib by Simon Josefsson. */ #ifndef ARCTWO_H -# define ARCTWO_H +#define ARCTWO_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif -# include -# include typedef struct { @@ -58,4 +63,9 @@ extern void arctwo_decrypt (arctwo_context *context, const char *inbuf, char *restrict outbuf, size_t length); + +#ifdef __cplusplus +} +#endif + #endif /* ARCTWO_H */ diff --git a/lib/areadlink.h b/lib/areadlink.h index d7ffaa2f3c..88ad14e8a8 100644 --- a/lib/areadlink.h +++ b/lib/areadlink.h @@ -20,6 +20,11 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + extern char *areadlink (char const *filename) _GL_ATTRIBUTE_DEALLOC_FREE; extern char *areadlink_with_size (char const *filename, size_t size_hint) @@ -35,3 +40,8 @@ extern char *areadlinkat_with_size (int fd, char const *filename, size_t size_hint) _GL_ATTRIBUTE_DEALLOC_FREE; #endif + + +#ifdef __cplusplus +} +#endif diff --git a/lib/argv-iter.h b/lib/argv-iter.h index d75a26416c..8f8823ad5f 100644 --- a/lib/argv-iter.h +++ b/lib/argv-iter.h @@ -24,6 +24,11 @@ /* Definition of _GL_ARG_NONNULL. */ #include "arg-nonnull.h" +#ifdef __cplusplus +extern "C" { +#endif + + struct argv_iterator; enum argv_iter_err @@ -45,3 +50,8 @@ char *argv_iter (struct argv_iterator *, enum argv_iter_err *) _GL_ARG_NONNULL ((1, 2)); size_t argv_iter_n_args (struct argv_iterator const *) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1)); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/argz.in.h b/lib/argz.in.h index c3fc8c3561..e37a1fd306 100644 --- a/lib/argz.in.h +++ b/lib/argz.in.h @@ -24,6 +24,11 @@ #include #include /* Need size_t. */ +#ifdef __cplusplus +extern "C" { +#endif + + #ifndef __error_t_defined typedef int error_t; #endif @@ -127,4 +132,8 @@ extern char *argz_next (const char *restrict /*argz*/, size_t /*argz_len*/, const char *restrict /*entry*/); +#ifdef __cplusplus +} +#endif + #endif /* argz.h */ diff --git a/lib/binary-io.h b/lib/binary-io.h index 0cc5c11748..1da018fad8 100644 --- a/lib/binary-io.h +++ b/lib/binary-io.h @@ -55,6 +55,11 @@ __gl_setmode (_GL_UNUSED int fd, _GL_UNUSED int mode) } #endif +#ifdef __cplusplus +extern "C" { +#endif + + /* Set FD's mode to MODE, which should be either O_TEXT or O_BINARY. Return the old mode if successful, -1 (setting errno) on failure. Ordinarily this function would be called 'setmode', since that is @@ -74,6 +79,11 @@ set_binary_mode (int fd, int mode) /* This macro is obsolescent. */ #define SET_BINARY(fd) ((void) set_binary_mode (fd, O_BINARY)) + +#ifdef __cplusplus +} +#endif + _GL_INLINE_HEADER_END #endif /* _BINARY_H */ diff --git a/lib/bitrotate.h b/lib/bitrotate.h index 91744cc5f9..dd3afa6b6a 100644 --- a/lib/bitrotate.h +++ b/lib/bitrotate.h @@ -33,6 +33,11 @@ _GL_INLINE_HEADER_BEGIN # define BITROTATE_INLINE _GL_INLINE #endif +#ifdef __cplusplus +extern "C" { +#endif + + #ifdef UINT64_MAX /* Given an unsigned 64-bit argument X, return the value corresponding to rotating the bits N steps to the left. N must be between 1 and @@ -135,6 +140,11 @@ rotr8 (uint8_t x, int n) return (((unsigned int) x >> n) | ((unsigned int) x << (8 - n))) & UINT8_MAX; } + +#ifdef __cplusplus +} +#endif + _GL_INLINE_HEADER_END #endif /* _GL_BITROTATE_H */ diff --git a/lib/bitset.h b/lib/bitset.h index 3f6325f830..975f31d548 100644 --- a/lib/bitset.h +++ b/lib/bitset.h @@ -36,6 +36,11 @@ #include "bitset/base.h" #include "obstack.h" +#ifdef __cplusplus +extern "C" { +#endif + + /* Attributes used to select a bitset implementation. */ enum bitset_attr {BITSET_FIXED = 1, /* Bitset size fixed. */ BITSET_VARIABLE = 2, /* Bitset size variable. */ @@ -398,4 +403,9 @@ void debug_bitset (bitset); /* Function to debug bitset stats from debugger. */ void debug_bitset_stats (void); + +#ifdef __cplusplus +} +#endif + #endif /* _GL_BITSET_H */ diff --git a/lib/bitsetv.h b/lib/bitsetv.h index f45030ca29..3be6157d50 100644 --- a/lib/bitsetv.h +++ b/lib/bitsetv.h @@ -28,6 +28,11 @@ #include "bitset.h" +#ifdef __cplusplus +extern "C" { +#endif + + typedef bitset * bitsetv; /* Free vector of bitsets. Do nothing if NULL. */ @@ -68,4 +73,9 @@ void debug_bitsetv (bitsetv); /* Dump vector of bitsets as a matrix. */ void bitsetv_matrix_dump (FILE *, const char *, bitsetv); + +#ifdef __cplusplus +} +#endif + #endif /* _BITSETV_H */ diff --git a/lib/c-strcaseeq.h b/lib/c-strcaseeq.h index 26e05c93c3..0348c559ca 100644 --- a/lib/c-strcaseeq.h +++ b/lib/c-strcaseeq.h @@ -19,6 +19,11 @@ #include "c-strcase.h" #include "c-ctype.h" +#ifdef __cplusplus +extern "C" { +#endif + + /* STRCASEEQ allows to optimize string comparison with a small literal string. STRCASEEQ (s, "UTF-8", 'U','T','F','-','8',0,0,0,0) is semantically equivalent to @@ -179,3 +184,8 @@ strcaseeq0 (const char *s1, const char *s2, char s20, char s21, char s22, char s (c_strcasecmp (s1, s2) == 0) #endif + + +#ifdef __cplusplus +} +#endif diff --git a/lib/canon-host.h b/lib/canon-host.h index 3c7e5785cd..5565bd89a6 100644 --- a/lib/canon-host.h +++ b/lib/canon-host.h @@ -18,14 +18,19 @@ along with this program. If not, see . */ #ifndef CANON_HOST_H -# define CANON_HOST_H 1 +#define CANON_HOST_H 1 /* This file uses _GL_ATTRIBUTE_MALLOC. */ -# if !_GL_CONFIG_H_INCLUDED -# error "Please include config.h first." -# endif +#if !_GL_CONFIG_H_INCLUDED +# error "Please include config.h first." +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif -# include char *canon_host (char const *host) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; @@ -33,6 +38,11 @@ char *canon_host_r (char const *host, int *cherror) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; const char *ch_strerror (void); -# define ch_strerror_r(cherror) gai_strerror (cherror); +#define ch_strerror_r(cherror) gai_strerror (cherror); + + +#ifdef __cplusplus +} +#endif #endif /* !CANON_HOST_H */ diff --git a/lib/careadlinkat.h b/lib/careadlinkat.h index 473e6531e6..2c552b692a 100644 --- a/lib/careadlinkat.h +++ b/lib/careadlinkat.h @@ -28,6 +28,11 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + + struct allocator; /* Assuming the current directory is FD, get the symbolic link value @@ -69,4 +74,9 @@ char *careadlinkat (int fd, char const *filename, # endif #endif + +#ifdef __cplusplus +} +#endif + #endif /* _GL_CAREADLINKAT_H */ diff --git a/lib/chdir-long.h b/lib/chdir-long.h index 2f24fa08eb..c679d11f46 100644 --- a/lib/chdir-long.h +++ b/lib/chdir-long.h @@ -21,6 +21,11 @@ #include "pathmax.h" +#ifdef __cplusplus +extern "C" { +#endif + + /* On systems without PATH_MAX, presume that chdir accepts arbitrarily long directory names. */ #ifndef PATH_MAX @@ -28,3 +33,8 @@ #else int chdir_long (char *dir); #endif + + +#ifdef __cplusplus +} +#endif diff --git a/lib/check-version.h b/lib/check-version.h index 43193a7b03..01750eac76 100644 --- a/lib/check-version.h +++ b/lib/check-version.h @@ -19,7 +19,17 @@ #ifndef CHECK_VERSION_H # define CHECK_VERSION_H +#ifdef __cplusplus +extern "C" { +#endif + + extern const char * check_version (const char *req_version); + +#ifdef __cplusplus +} +#endif + #endif /* CHECK_VERSION_H */ diff --git a/lib/classpath.h b/lib/classpath.h index 665dc60c89..d4c199b8c1 100644 --- a/lib/classpath.h +++ b/lib/classpath.h @@ -20,6 +20,11 @@ #error "Please include config.h first." #endif +#ifdef __cplusplus +extern "C" { +#endif + + /* Return the new CLASSPATH value. The given classpaths are prepended to the current CLASSPATH value. If use_minimal_classpath, the current CLASSPATH is ignored. */ @@ -35,3 +40,8 @@ extern char * set_classpath (const char * const *classpaths, /* Restore CLASSPATH to its previous value. */ extern void reset_classpath (char *old_classpath); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/cloexec.h b/lib/cloexec.h index f52e5f2ec0..a7944d6dd5 100644 --- a/lib/cloexec.h +++ b/lib/cloexec.h @@ -15,6 +15,11 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ +#ifdef __cplusplus +extern "C" { +#endif + + /* Set the 'FD_CLOEXEC' flag of DESC if VALUE is true, or clear the flag if VALUE is false. Return 0 on success, or -1 on error with 'errno' set. @@ -32,3 +37,8 @@ int set_cloexec_flag (int desc, bool value); be duplicated. */ int dup_cloexec (int fd); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/close-stream.h b/lib/close-stream.h index 8a1b3c7ac2..3c421dce51 100644 --- a/lib/close-stream.h +++ b/lib/close-stream.h @@ -17,4 +17,14 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + int close_stream (FILE *stream); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/crc.h b/lib/crc.h index 7312443794..4014216cc3 100644 --- a/lib/crc.h +++ b/lib/crc.h @@ -17,11 +17,16 @@ /* Written by Simon Josefsson. */ #ifndef CRC_H -# define CRC_H 1 +#define CRC_H 1 #include #include +#ifdef __cplusplus +extern "C" { +#endif + + /* Compute CRC-32 value of LEN bytes long BUF, and return it. */ extern uint32_t crc32 (const char *buf, size_t len); @@ -44,4 +49,9 @@ extern uint32_t crc32_no_xor (const char *buf, size_t len); extern uint32_t crc32_update_no_xor (uint32_t crc, const char *buf, size_t len); + +#ifdef __cplusplus +} +#endif + #endif /* CRC_H */ diff --git a/lib/csharpcomp.h b/lib/csharpcomp.h index 1bad3d7c48..4311aa100c 100644 --- a/lib/csharpcomp.h +++ b/lib/csharpcomp.h @@ -18,6 +18,11 @@ #ifndef _CSHARPCOMP_H #define _CSHARPCOMP_H +#ifdef __cplusplus +extern "C" { +#endif + + /* Compile a set of C# source files to bytecode. sources is an array of source file names, including resource files. libdirs is a list of directories to be searched for libraries. @@ -35,4 +40,9 @@ extern bool compile_csharp_class (const char * const *sources, bool optimize, bool debug, bool verbose); + +#ifdef __cplusplus +} +#endif + #endif /* _CSHARPCOMP_H */ diff --git a/lib/csharpexec.h b/lib/csharpexec.h index 7f798b6318..96b0dcf9c2 100644 --- a/lib/csharpexec.h +++ b/lib/csharpexec.h @@ -18,6 +18,11 @@ #ifndef _CSHARPEXEC_H #define _CSHARPEXEC_H +#ifdef __cplusplus +extern "C" { +#endif + + typedef bool execute_fn (const char *progname, const char *prog_path, const char * const *prog_argv, void *private_data); @@ -38,4 +43,9 @@ extern bool execute_csharp_program (const char *assembly_path, bool verbose, bool quiet, execute_fn *executer, void *private_data); + +#ifdef __cplusplus +} +#endif + #endif /* _CSHARPEXEC_H */ diff --git a/lib/cycle-check.h b/lib/cycle-check.h index 92d385fa0b..d0e3d852b5 100644 --- a/lib/cycle-check.h +++ b/lib/cycle-check.h @@ -18,11 +18,16 @@ /* Written by Jim Meyering */ #ifndef CYCLE_CHECK_H -# define CYCLE_CHECK_H 1 +#define CYCLE_CHECK_H 1 + +#include +#include "dev-ino.h" +#include "same-inode.h" + +#ifdef __cplusplus +extern "C" { +#endif -# include -# include "dev-ino.h" -# include "same-inode.h" struct cycle_check_state { @@ -34,7 +39,7 @@ struct cycle_check_state void cycle_check_init (struct cycle_check_state *state); bool cycle_check (struct cycle_check_state *state, struct stat const *sb); -# define CYCLE_CHECK_REFLECT_CHDIR_UP(State, SB_dir, SB_subdir) \ +#define CYCLE_CHECK_REFLECT_CHDIR_UP(State, SB_dir, SB_subdir) \ do \ { \ /* You must call cycle_check at least once before using this macro. */ \ @@ -48,4 +53,9 @@ bool cycle_check (struct cycle_check_state *state, struct stat const *sb); } \ while (0) + +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/des.h b/lib/des.h index c4a1784d55..b8057a4209 100644 --- a/lib/des.h +++ b/lib/des.h @@ -19,11 +19,16 @@ /* Adapted for gnulib by Simon Josefsson, based on Libgcrypt. */ #ifndef DES_H -# define DES_H +#define DES_H #include #include +#ifdef __cplusplus +extern "C" { +#endif + + /* * Encryption/Decryption context of DES */ @@ -115,4 +120,9 @@ gl_3des_ecb_crypt (gl_3des_ctx *ctx, #define gl_3des_ecb_encrypt(ctx, from, to) gl_3des_ecb_crypt(ctx,from,to,0) #define gl_3des_ecb_decrypt(ctx, from, to) gl_3des_ecb_crypt(ctx,from,to,1) + +#ifdef __cplusplus +} +#endif + #endif /* DES_H */ diff --git a/lib/dev-ino.h b/lib/dev-ino.h index 13e500289c..38cb88deaf 100644 --- a/lib/dev-ino.h +++ b/lib/dev-ino.h @@ -17,10 +17,15 @@ /* Written by Jim Meyering, 2003. */ #ifndef DEV_INO_H -# define DEV_INO_H 1 +#define DEV_INO_H 1 + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif -# include -# include struct dev_ino { @@ -28,4 +33,9 @@ struct dev_ino dev_t st_dev; }; + +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/di-set.h b/lib/di-set.h index aa59a01f46..215532fe4b 100644 --- a/lib/di-set.h +++ b/lib/di-set.h @@ -17,15 +17,20 @@ /* Written by Jim Meyering, 2010. */ #ifndef _GL_DI_SET_H -# define _GL_DI_SET_H +#define _GL_DI_SET_H /* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_NONNULL. */ -# if !_GL_CONFIG_H_INCLUDED -# error "Please include config.h first." -# endif +#if !_GL_CONFIG_H_INCLUDED +# error "Please include config.h first." +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif -# include struct di_set; @@ -39,4 +44,9 @@ int di_set_insert (struct di_set *, dev_t, ino_t) _GL_ATTRIBUTE_NONNULL ((1)); int di_set_lookup (struct di_set *dis, dev_t dev, ino_t ino) _GL_ATTRIBUTE_NONNULL ((1)); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/eealloc.h b/lib/eealloc.h index 5cb274be8e..ff31da49cd 100644 --- a/lib/eealloc.h +++ b/lib/eealloc.h @@ -45,6 +45,11 @@ _GL_INLINE_HEADER_BEGIN # define EEALLOC_INLINE _GL_INLINE #endif +#ifdef __cplusplus +extern "C" { +#endif + + #if MALLOC_0_IS_NONNULL # define eemalloc malloc #else @@ -95,6 +100,11 @@ eerealloc (void *p, size_t n) eenrealloc (void *p, size_t n, size_t s) - like eerealloc (p, n * s) If this would be useful in your application. please speak up. */ + +#ifdef __cplusplus +} +#endif + _GL_INLINE_HEADER_END #endif /* _EEALLOC_H */ diff --git a/lib/exclude.h b/lib/exclude.h index 0783b08732..12743cf745 100644 --- a/lib/exclude.h +++ b/lib/exclude.h @@ -16,6 +16,9 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +/* Written by Paul Eggert + and Sergey Poznyakoff */ + #ifndef _GL_EXCLUDE_H #define _GL_EXCLUDE_H 1 @@ -27,8 +30,10 @@ #include -/* Written by Paul Eggert - and Sergey Poznyakoff */ +#ifdef __cplusplus +extern "C" { +#endif + /* Exclude options, which can be ORed with fnmatch options. */ @@ -67,4 +72,9 @@ bool excluded_file_name (struct exclude const *, char const *); void exclude_add_pattern_buffer (struct exclude *ex, char *buf); bool exclude_fnmatch (char const *, char const *, int); + +#ifdef __cplusplus +} +#endif + #endif /* _GL_EXCLUDE_H */ diff --git a/lib/execinfo.in.h b/lib/execinfo.in.h index 0ffb2c386e..e017947bca 100644 --- a/lib/execinfo.in.h +++ b/lib/execinfo.in.h @@ -30,6 +30,11 @@ _GL_INLINE_HEADER_BEGIN # define _GL_EXECINFO_INLINE _GL_INLINE #endif +#ifdef __cplusplus +extern "C" { +#endif + + _GL_EXECINFO_INLINE int backtrace (void **buffer, int size) { @@ -54,6 +59,11 @@ backtrace_symbols_fd (void *const *buffer, int size, int fd) (void) fd; } + +#ifdef __cplusplus +} +#endif + _GL_INLINE_HEADER_END #endif diff --git a/lib/execute.h b/lib/execute.h index da50e9224d..27ac081f5e 100644 --- a/lib/execute.h +++ b/lib/execute.h @@ -18,6 +18,11 @@ #ifndef _EXECUTE_H #define _EXECUTE_H +#ifdef __cplusplus +extern "C" { +#endif + + /* Execute a command, optionally redirecting any of the three standard file descriptors to /dev/null. Return its exit code. If it didn't terminate correctly, exit if exit_on_error is true, otherwise @@ -51,4 +56,9 @@ extern int execute (const char *progname, bool slave_process, bool exit_on_error, int *termsigp); + +#ifdef __cplusplus +} +#endif + #endif /* _EXECUTE_H */ diff --git a/lib/exitfail.h b/lib/exitfail.h index 20ac506b4a..fa264b5c8c 100644 --- a/lib/exitfail.h +++ b/lib/exitfail.h @@ -15,4 +15,14 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ +#ifdef __cplusplus +extern "C" { +#endif + + extern int volatile exit_failure; + + +#ifdef __cplusplus +} +#endif diff --git a/lib/fcntl-safer.h b/lib/fcntl-safer.h index 75f7142e30..347cac0bd1 100644 --- a/lib/fcntl-safer.h +++ b/lib/fcntl-safer.h @@ -19,9 +19,19 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + int open_safer (char const *, int, ...); int creat_safer (char const *, mode_t); #if GNULIB_OPENAT_SAFER int openat_safer (int, char const *, int, ...); #endif + + +#ifdef __cplusplus +} +#endif diff --git a/lib/file-set.h b/lib/file-set.h index 17e89ca154..d4c977b0b0 100644 --- a/lib/file-set.h +++ b/lib/file-set.h @@ -21,6 +21,11 @@ #include "hash.h" +#ifdef __cplusplus +extern "C" { +#endif + + extern void record_file (Hash_table *ht, char const *file, struct stat const *stats) #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__ @@ -30,3 +35,8 @@ extern void record_file (Hash_table *ht, char const *file, extern bool seen_file (Hash_table const *ht, char const *file, struct stat const *stats); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/file-type.h b/lib/file-type.h index 7ca0357aef..862c4b493e 100644 --- a/lib/file-type.h +++ b/lib/file-type.h @@ -19,17 +19,27 @@ /* Written by Paul Eggert and Jim Meyering. */ #ifndef FILE_TYPE_H -# define FILE_TYPE_H 1 +#define FILE_TYPE_H 1 /* This file uses _GL_ATTRIBUTE_PURE. */ -# if !_GL_CONFIG_H_INCLUDED -# error "Please include config.h first." -# endif +#if !_GL_CONFIG_H_INCLUDED +# error "Please include config.h first." +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif -# include -# include char const *c_file_type (struct stat const *) _GL_ATTRIBUTE_PURE; char const *file_type (struct stat const *) _GL_ATTRIBUTE_PURE; + +#ifdef __cplusplus +} +#endif + #endif /* FILE_TYPE_H */ diff --git a/lib/filenamecat.h b/lib/filenamecat.h index 8c8cf44199..618fb314bb 100644 --- a/lib/filenamecat.h +++ b/lib/filenamecat.h @@ -25,6 +25,11 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + #if GNULIB_FILENAMECAT char *file_name_concat (char const *dir, char const *base, char **base_in_result) @@ -35,3 +40,8 @@ char *file_name_concat (char const *dir, char const *base, char *mfile_name_concat (char const *dir, char const *base, char **base_in_result) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; + + +#ifdef __cplusplus +} +#endif diff --git a/lib/filevercmp.h b/lib/filevercmp.h index 8c549fcda0..81f821d526 100644 --- a/lib/filevercmp.h +++ b/lib/filevercmp.h @@ -27,6 +27,11 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + /* Compare strings A and B as file names containing version numbers, and return an integer that is negative, zero, or positive depending on whether A compares less than, equal to, or greater than B. @@ -80,4 +85,9 @@ int filevercmp (char const *a, char const *b) _GL_ATTRIBUTE_PURE; int filenvercmp (char const *a, ptrdiff_t alen, char const *b, ptrdiff_t blen) _GL_ATTRIBUTE_PURE; + +#ifdef __cplusplus +} +#endif + #endif /* FILEVERCMP_H */ diff --git a/lib/fpending.h b/lib/fpending.h index 28db3b403d..345c0bc71d 100644 --- a/lib/fpending.h +++ b/lib/fpending.h @@ -30,6 +30,16 @@ # include #endif +#ifdef __cplusplus +extern "C" { +#endif + + #if !HAVE_DECL___FPENDING size_t __fpending (FILE *) _GL_ATTRIBUTE_PURE; #endif + + +#ifdef __cplusplus +} +#endif diff --git a/lib/fprintftime.h b/lib/fprintftime.h index a36325bf38..0001fef027 100644 --- a/lib/fprintftime.h +++ b/lib/fprintftime.h @@ -18,6 +18,11 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + + /* A cross between fprintf and nstrftime, that prints directly to the output stream, without the need for the potentially large buffer that nstrftime would require. @@ -27,3 +32,8 @@ and NANOSECONDS values. */ size_t fprintftime (FILE *fp, char const *fmt, struct tm const *tm, timezone_t zone, int nanoseconds); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/fpucw.h b/lib/fpucw.h index c7387a2299..fdc53b811b 100644 --- a/lib/fpucw.h +++ b/lib/fpucw.h @@ -61,6 +61,11 @@ 'long double' safe operation precision */ +#ifdef __cplusplus +extern "C" { +#endif + + /* Inline assembler like this works only with GNU C and clang. */ #if (defined __i386__ || defined __x86_64__) && (defined __GNUC__ || defined __clang__) @@ -105,4 +110,9 @@ typedef unsigned int fpucw_t; #endif + +#ifdef __cplusplus +} +#endif + #endif /* _FPUCW_H */ diff --git a/lib/fsusage.h b/lib/fsusage.h index d7ae5f63a3..da87859060 100644 --- a/lib/fsusage.h +++ b/lib/fsusage.h @@ -19,9 +19,14 @@ /* Space usage statistics for a file system. Blocks are 512-byte. */ #if !defined FSUSAGE_H_ -# define FSUSAGE_H_ +#define FSUSAGE_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif -# include struct fs_usage { @@ -36,4 +41,9 @@ struct fs_usage int get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/ftoastr.h b/lib/ftoastr.h index ed43c961a0..94554863a1 100644 --- a/lib/ftoastr.h +++ b/lib/ftoastr.h @@ -24,6 +24,11 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + + /* Store into BUF (of size BUFSIZE) an accurate minimal-precision string representation of a floating point number. FLAGS affect the formatting of the number. Pad the output string with spaces as @@ -149,4 +154,9 @@ enum #define DBL_BUFSIZE_BOUND ( DBL_STRLEN_BOUND + 1) #define LDBL_BUFSIZE_BOUND (LDBL_STRLEN_BOUND + 1) + +#ifdef __cplusplus +} +#endif + #endif /* _GL_FTOASTR_H */ diff --git a/lib/full-read.h b/lib/full-read.h index 5f73a19ae9..617702a60b 100644 --- a/lib/full-read.h +++ b/lib/full-read.h @@ -17,7 +17,17 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + /* Read COUNT bytes at BUF to descriptor FD, retrying if interrupted or if partial reads occur. Return the number of bytes successfully read, setting errno if that is less than COUNT. errno = 0 means EOF. */ extern size_t full_read (int fd, void *buf, size_t count); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/gc.h b/lib/gc.h index 0f28f8356f..51ad0dd7e1 100644 --- a/lib/gc.h +++ b/lib/gc.h @@ -17,15 +17,20 @@ */ #ifndef _GL_GC_H -# define _GL_GC_H +#define _GL_GC_H /* This file uses _GL_ATTRIBUTE_CONST. */ -# if !_GL_CONFIG_H_INCLUDED -# error "Please include config.h first." -# endif +#if !_GL_CONFIG_H_INCLUDED +# error "Please include config.h first." +#endif /* Get size_t. */ -# include +#include + +#ifdef __cplusplus +extern "C" { +#endif + enum Gc_rc { @@ -337,4 +342,9 @@ gc_pbkdf2_sha1 (const char *P, size_t Plen, Simon */ + +#ifdef __cplusplus +} +#endif + #endif /* _GL_GC_H */ diff --git a/lib/getndelim2.h b/lib/getndelim2.h index ed50d36ea4..34cfa2d4f1 100644 --- a/lib/getndelim2.h +++ b/lib/getndelim2.h @@ -22,6 +22,11 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + + #define GETNLINE_NO_LIMIT ((size_t) -1) /* Read into a buffer *LINEPTR returned from malloc (or NULL), @@ -39,4 +44,9 @@ extern ssize_t getndelim2 (char **lineptr, size_t *linesize, size_t offset, size_t nmax, int delim1, int delim2, FILE *stream); + +#ifdef __cplusplus +} +#endif + #endif /* GETNDELIM2_H */ diff --git a/lib/getnline.h b/lib/getnline.h index 0f27e64a44..d16c6ae553 100644 --- a/lib/getnline.h +++ b/lib/getnline.h @@ -21,6 +21,11 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + + #define GETNLINE_NO_LIMIT ((size_t) -1) /* Read a line, up to the next newline, from STREAM, and store it in *LINEPTR. @@ -44,4 +49,9 @@ extern ssize_t getnline (char **lineptr, size_t *linesize, size_t nmax, extern ssize_t getndelim (char **lineptr, size_t *linesize, size_t nmax, int delimiter, FILE *stream); + +#ifdef __cplusplus +} +#endif + #endif /* GETNLINE_H */ diff --git a/lib/getugroups.h b/lib/getugroups.h index 1fa4fd360d..c5cfd314d0 100644 --- a/lib/getugroups.h +++ b/lib/getugroups.h @@ -15,5 +15,16 @@ along with this program. If not, see . */ #include + +#ifdef __cplusplus +extern "C" { +#endif + + int getugroups (int maxcount, gid_t *grouplist, char const *username, gid_t gid); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/glthread/tls.h b/lib/glthread/tls.h index 20ec62d2b9..ab8839f422 100644 --- a/lib/glthread/tls.h +++ b/lib/glthread/tls.h @@ -71,6 +71,10 @@ # include +# ifdef __cplusplus +extern "C" { +# endif + /* ------------------------- gl_tls_key_t datatype ------------------------- */ typedef tss_t gl_tls_key_t; @@ -83,6 +87,10 @@ typedef tss_t gl_tls_key_t; # define glthread_tls_key_destroy(KEY) \ (tss_delete (*(KEY)), 0) +# ifdef __cplusplus +} +# endif + #endif /* ========================================================================= */ @@ -93,6 +101,10 @@ typedef tss_t gl_tls_key_t; # include +# ifdef __cplusplus +extern "C" { +# endif + # if PTHREAD_IN_USE_DETECTION_HARD /* The pthread_in_use() detection needs to be done at runtime. */ @@ -151,6 +163,10 @@ typedef union # define glthread_tls_key_destroy(KEY) \ (pthread_in_use () ? pthread_key_delete ((KEY)->key) : 0) +# ifdef __cplusplus +} +# endif + #endif /* ========================================================================= */ @@ -162,6 +178,10 @@ typedef union # include "windows-tls.h" +# ifdef __cplusplus +extern "C" { +# endif + /* ------------------------- gl_tls_key_t datatype ------------------------- */ typedef glwthread_tls_key_t gl_tls_key_t; @@ -174,6 +194,10 @@ typedef glwthread_tls_key_t gl_tls_key_t; # define glthread_tls_key_destroy(KEY) \ glwthread_tls_key_delete (*(KEY)) +# ifdef __cplusplus +} +# endif + #endif /* ========================================================================= */ @@ -182,6 +206,10 @@ typedef glwthread_tls_key_t gl_tls_key_t; /* Provide dummy implementation if threads are not supported. */ +# ifdef __cplusplus +extern "C" { +# endif + /* ------------------------- gl_tls_key_t datatype ------------------------- */ typedef struct @@ -200,6 +228,10 @@ typedef struct # define glthread_tls_key_destroy(KEY) \ 0 +# ifdef __cplusplus +} +# endif + #endif /* ========================================================================= */ diff --git a/lib/hamt.h b/lib/hamt.h index 91d2f15e57..a25c612731 100644 --- a/lib/hamt.h +++ b/lib/hamt.h @@ -74,6 +74,11 @@ _GL_INLINE_HEADER_BEGIN #include #include +#ifdef __cplusplus +extern "C" { +#endif + + /* Hash values are of type size_t. For each level of the trie, we use 5 bits (corresponding to lg2 of the width of a 32-bit word. */ #define _GL_HAMT_MAX_DEPTH ((SIZE_WIDTH + 4) / 5) @@ -259,6 +264,11 @@ extern bool hamt_replace_x (Hamt *hamt, Hamt_entry *elt); false. */ extern bool hamt_remove_x (Hamt *hamt, Hamt_entry *elt); + +#ifdef __cplusplus +} +#endif + _GL_INLINE_HEADER_END #endif /* _GL_HAMT_H */ diff --git a/lib/hard-locale.h b/lib/hard-locale.h index 21c5c546d3..5d40e522a4 100644 --- a/lib/hard-locale.h +++ b/lib/hard-locale.h @@ -16,7 +16,12 @@ along with this program. If not, see . */ #ifndef HARD_LOCALE_H_ -# define HARD_LOCALE_H_ 1 +#define HARD_LOCALE_H_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + /* Return true if the specified CATEGORY of the current locale is hard, i.e. different from the C or POSIX locale that has a fixed behavior. @@ -25,4 +30,9 @@ per-thread locale. */ extern bool hard_locale (int category); + +#ifdef __cplusplus +} +#endif + #endif /* HARD_LOCALE_H_ */ diff --git a/lib/hash-pjw-bare.h b/lib/hash-pjw-bare.h index ed5e11efc0..fe74805def 100644 --- a/lib/hash-pjw-bare.h +++ b/lib/hash-pjw-bare.h @@ -21,9 +21,19 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + /* Compute a hash code for a buffer starting at X and of size N, and return the hash code. Note that unlike hash_pjw(), it does not return it modulo a table size. The result is platform dependent: it depends on the size of the 'size_t' type. */ extern size_t hash_pjw_bare (const void *x, size_t n) _GL_ATTRIBUTE_PURE; + + +#ifdef __cplusplus +} +#endif diff --git a/lib/hash-pjw.h b/lib/hash-pjw.h index 7c60d16f58..2962dfc4b4 100644 --- a/lib/hash-pjw.h +++ b/lib/hash-pjw.h @@ -21,8 +21,18 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + /* Compute a hash code for a NUL-terminated string starting at X, and return the hash code modulo TABLESIZE. The result is platform dependent: it depends on the size of the 'size_t' type and on the signedness of the 'char' type. */ extern size_t hash_pjw (void const *x, size_t tablesize) _GL_ATTRIBUTE_PURE; + + +#ifdef __cplusplus +} +#endif diff --git a/lib/hash-triple.h b/lib/hash-triple.h index 9135e73435..b80ea577cc 100644 --- a/lib/hash-triple.h +++ b/lib/hash-triple.h @@ -27,6 +27,11 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + + /* Describe a just-created or just-renamed destination file. */ struct F_triple { @@ -47,4 +52,9 @@ extern size_t triple_hash_no_name (void const *x, size_t table_size) _GL_ATTRIBUTE_PURE; extern bool triple_compare (void const *x, void const *y); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/hmac.h b/lib/hmac.h index cf1cd6efb1..41b27122a2 100644 --- a/lib/hmac.h +++ b/lib/hmac.h @@ -17,10 +17,15 @@ /* Written by Simon Josefsson. */ #ifndef HMAC_H -# define HMAC_H 1 +#define HMAC_H 1 #include +#ifdef __cplusplus +extern "C" { +#endif + + /* Compute Hashed Message Authentication Code with MD5, as described in RFC 2104, over BUFFER data of BUFLEN bytes using the KEY of KEYLEN bytes, writing the output to pre-allocated 16 byte minimum @@ -53,4 +58,9 @@ int hmac_sha512 (const void *key, size_t keylen, const void *in, size_t inlen, void *restrict resbuf); + +#ifdef __cplusplus +} +#endif + #endif /* HMAC_H */ diff --git a/lib/human.h b/lib/human.h index f89e7640b2..6d8a59830a 100644 --- a/lib/human.h +++ b/lib/human.h @@ -18,13 +18,18 @@ /* Written by Paul Eggert and Larry McVoy. */ #ifndef HUMAN_H_ -# define HUMAN_H_ 1 +#define HUMAN_H_ 1 -# include -# include -# include +#include +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif -# include /* A conservative bound on the maximum length of a human-readable string. The output can be the square of the largest uintmax_t, so double @@ -34,7 +39,7 @@ so multiply by MB_LEN_MAX + 1 and then subtract MB_LEN_MAX. Append 1 for a space before the suffix. Finally, append 3, the maximum length of a suffix. */ -# define LONGEST_HUMAN_READABLE \ +#define LONGEST_HUMAN_READABLE \ ((2 * sizeof (uintmax_t) * CHAR_BIT * 146 / 485 + 1) * (MB_LEN_MAX + 1) \ - MB_LEN_MAX + 1 + 3) @@ -79,4 +84,9 @@ char *human_readable (uintmax_t, char *, int, uintmax_t, uintmax_t); enum strtol_error human_options (char const *, int *, uintmax_t *); + +#ifdef __cplusplus +} +#endif + #endif /* HUMAN_H_ */ diff --git a/lib/i-ring.h b/lib/i-ring.h index 7a493f6701..2dfcd40658 100644 --- a/lib/i-ring.h +++ b/lib/i-ring.h @@ -20,6 +20,11 @@ #error "Please include config.h first." #endif +#ifdef __cplusplus +extern "C" { +#endif + + enum { I_RING_SIZE = 4 }; static_assert (1 <= I_RING_SIZE); @@ -45,3 +50,8 @@ void i_ring_init (I_ring *ir, int ir_default_val); int i_ring_push (I_ring *ir, int val); int i_ring_pop (I_ring *ir); bool i_ring_empty (I_ring const *ir) _GL_ATTRIBUTE_PURE; + + +#ifdef __cplusplus +} +#endif diff --git a/lib/idcache.h b/lib/idcache.h index 55f3ab7596..89014162a0 100644 --- a/lib/idcache.h +++ b/lib/idcache.h @@ -17,13 +17,23 @@ /* Written by Jim Meyering, 2007. */ #ifndef IDCACHE_H -# define IDCACHE_H 1 +#define IDCACHE_H 1 + +#include + +#ifdef __cplusplus +extern "C" { +#endif -# include extern char *getuser (uid_t uid); extern char *getgroup (gid_t gid); extern uid_t *getuidbyname (const char *user); extern gid_t *getgidbyname (const char *group); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/idx.h b/lib/idx.h index f9ce0acd57..43793f2d62 100644 --- a/lib/idx.h +++ b/lib/idx.h @@ -111,6 +111,11 @@ help producing good code and good warnings. The type 'idx_t' could then be typedef'ed to a range type that is signed after promotion. */ +#ifdef __cplusplus +extern "C" { +#endif + + /* In the future, idx_t could be typedef'ed to a signed range type. The clang "extended integer types", supported in Clang 11 or newer , @@ -131,4 +136,9 @@ typedef ptrdiff_t idx_t; Perhaps there should be another macro IDX_VALUE_BITS that does not count the sign bit and is therefore one less than PTRDIFF_WIDTH. */ + +#ifdef __cplusplus +} +#endif + #endif /* _IDX_H */ diff --git a/lib/ino-map.h b/lib/ino-map.h index 4aa33754e4..06dd4af6ca 100644 --- a/lib/ino-map.h +++ b/lib/ino-map.h @@ -17,17 +17,22 @@ /* Written by Paul Eggert, 2010. */ #ifndef _GL_INO_MAP_H -# define _GL_INO_MAP_H +#define _GL_INO_MAP_H /* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_NONNULL. */ -# if !_GL_CONFIG_H_INCLUDED -# error "Please include config.h first." -# endif +#if !_GL_CONFIG_H_INCLUDED +# error "Please include config.h first." +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif -# include -# define INO_MAP_INSERT_FAILURE ((size_t) -1) +#define INO_MAP_INSERT_FAILURE ((size_t) -1) struct ino_map; @@ -38,4 +43,9 @@ struct ino_map *ino_map_alloc (size_t) size_t ino_map_insert (struct ino_map *, ino_t) _GL_ATTRIBUTE_NONNULL ((1)); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/inttostr.h b/lib/inttostr.h index 51cadf42e8..8f1bb36e68 100644 --- a/lib/inttostr.h +++ b/lib/inttostr.h @@ -27,8 +27,18 @@ #include "intprops.h" +#ifdef __cplusplus +extern "C" { +#endif + + _GL_ATTRIBUTE_NODISCARD char *imaxtostr (intmax_t, char *); _GL_ATTRIBUTE_NODISCARD char *inttostr (int, char *); _GL_ATTRIBUTE_NODISCARD char *offtostr (off_t, char *); _GL_ATTRIBUTE_NODISCARD char *uinttostr (unsigned int, char *); _GL_ATTRIBUTE_NODISCARD char *umaxtostr (uintmax_t, char *); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/isapipe.h b/lib/isapipe.h index affdca8a96..b86cf26367 100644 --- a/lib/isapipe.h +++ b/lib/isapipe.h @@ -20,9 +20,19 @@ #error "Please include config.h first." #endif +#ifdef __cplusplus +extern "C" { +#endif + + /* Whether pipes are FIFOs; -1 if not known. */ #ifndef HAVE_FIFO_PIPES # define HAVE_FIFO_PIPES (-1) #endif int isapipe (int fd); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/isnand-nolibm.h b/lib/isnand-nolibm.h index 4d8b0e8f53..925e71d17a 100644 --- a/lib/isnand-nolibm.h +++ b/lib/isnand-nolibm.h @@ -34,5 +34,9 @@ /* Test whether X is a NaN. */ # undef isnand # define isnand rpl_isnand -extern int isnand (double x); +extern +# ifdef __cplusplus +"C" +# endif +int isnand (double x); #endif diff --git a/lib/isnanf-nolibm.h b/lib/isnanf-nolibm.h index 520b8147d2..06f0cbb70d 100644 --- a/lib/isnanf-nolibm.h +++ b/lib/isnanf-nolibm.h @@ -35,12 +35,20 @@ # if defined __sgi /* We can't include , because it conflicts with our definition of isnand. Therefore declare isnanf separately. */ -extern int isnanf (float x); +extern +# ifdef __cplusplus +"C" +# endif +int isnanf (float x); # endif # endif #else /* Test whether X is a NaN. */ # undef isnanf # define isnanf rpl_isnanf -extern int isnanf (float x); +extern +# ifdef __cplusplus +"C" +# endif +int isnanf (float x); #endif diff --git a/lib/isnanl-nolibm.h b/lib/isnanl-nolibm.h index 3ea82f7d7d..0b6755cd82 100644 --- a/lib/isnanl-nolibm.h +++ b/lib/isnanl-nolibm.h @@ -35,5 +35,9 @@ /* Test whether X is a NaN. */ # undef isnanl # define isnanl rpl_isnanl -extern int isnanl (long double x); +extern +# ifdef __cplusplus +"C" +# endif +int isnanl (long double x); #endif diff --git a/lib/javacomp.h b/lib/javacomp.h index 84e5b24481..af42f000ea 100644 --- a/lib/javacomp.h +++ b/lib/javacomp.h @@ -18,6 +18,11 @@ #ifndef _JAVACOMP_H #define _JAVACOMP_H +#ifdef __cplusplus +extern "C" { +#endif + + /* Compile a Java source file to bytecode. java_sources is an array of source file names. classpaths is a list of pathnames to be prepended to the CLASSPATH. @@ -85,4 +90,9 @@ extern bool compile_java_class (const char * const *java_sources, bool use_minimal_classpath, bool verbose); + +#ifdef __cplusplus +} +#endif + #endif /* _JAVACOMP_H */ diff --git a/lib/javaexec.h b/lib/javaexec.h index 6d67b741b5..671f87289a 100644 --- a/lib/javaexec.h +++ b/lib/javaexec.h @@ -18,6 +18,11 @@ #ifndef _JAVAEXEC_H #define _JAVAEXEC_H +#ifdef __cplusplus +extern "C" { +#endif + + typedef bool execute_fn (const char *progname, const char *prog_path, const char * const *prog_argv, void *private_data); @@ -45,4 +50,9 @@ extern bool execute_java_class (const char *class_name, bool verbose, bool quiet, execute_fn *executer, void *private_data); + +#ifdef __cplusplus +} +#endif + #endif /* _JAVAEXEC_H */ diff --git a/lib/jit/cache.h b/lib/jit/cache.h index db00627ee3..94aef30526 100644 --- a/lib/jit/cache.h +++ b/lib/jit/cache.h @@ -38,6 +38,11 @@ # include #endif +#ifdef __cplusplus +extern "C" { +#endif + + /* Clears the instruction cache for addresses start <= address < end. We need this because some CPUs have separate data cache and instruction @@ -186,3 +191,8 @@ clear_cache (void *start, void *end) # error "Don't know how to implement clear_cache on this platform." #endif } + + +#ifdef __cplusplus +} +#endif diff --git a/lib/linebuffer.h b/lib/linebuffer.h index ae0d55dd02..9be2eca8eb 100644 --- a/lib/linebuffer.h +++ b/lib/linebuffer.h @@ -17,10 +17,15 @@ along with this program. If not, see . */ #if !defined LINEBUFFER_H -# define LINEBUFFER_H +#define LINEBUFFER_H + +#include "idx.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif -# include "idx.h" -# include /* A 'struct linebuffer' holds a line of text. */ @@ -51,4 +56,9 @@ struct linebuffer *readlinebuffer (struct linebuffer *linebuffer, FILE *stream); /* Free linebuffer LINEBUFFER and its data, all allocated with malloc. */ void freebuffer (struct linebuffer *); + +#ifdef __cplusplus +} +#endif + #endif /* LINEBUFFER_H */ diff --git a/lib/localeinfo.h b/lib/localeinfo.h index c75d75f836..f8863edf53 100644 --- a/lib/localeinfo.h +++ b/lib/localeinfo.h @@ -29,6 +29,11 @@ # include #endif +#ifdef __cplusplus +extern "C" { +#endif + + struct localeinfo { /* MB_CUR_MAX > 1. */ @@ -64,3 +69,8 @@ extern void init_localeinfo (struct localeinfo *); enum { CASE_FOLDED_BUFSIZE = 32 }; extern int case_folded_counterparts (wint_t, char32_t[CASE_FOLDED_BUFSIZE]); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/long-options.h b/lib/long-options.h index 61e90f9ebf..a32a13024d 100644 --- a/lib/long-options.h +++ b/lib/long-options.h @@ -20,6 +20,11 @@ #ifndef LONG_OPTIONS_H_ # define LONG_OPTIONS_H_ 1 +#ifdef __cplusplus +extern "C" { +#endif + + void parse_long_options (int _argc, char **_argv, const char *_command_name, @@ -37,4 +42,9 @@ void parse_gnu_standard_options_only (int argc, void (*usage_func) (int), /* const char *author1, ...*/ ...); + +#ifdef __cplusplus +} +#endif + #endif /* LONG_OPTIONS_H_ */ diff --git a/lib/mbchar.h b/lib/mbchar.h index c06ef11b14..5a1529ddcb 100644 --- a/lib/mbchar.h +++ b/lib/mbchar.h @@ -157,6 +157,11 @@ _GL_INLINE_HEADER_BEGIN # define MBCHAR_INLINE _GL_INLINE #endif +#ifdef __cplusplus +extern "C" { +#endif + + /* The longest multibyte characters, nowadays, are 4 bytes long. Regardless of the values of MB_CUR_MAX and MB_LEN_MAX. */ #define MBCHAR_BUF_SIZE 4 @@ -368,6 +373,11 @@ is_basic (char c) #endif + +#ifdef __cplusplus +} +#endif + _GL_INLINE_HEADER_END #endif /* _MBCHAR_H */ diff --git a/lib/mbfile.h b/lib/mbfile.h index bea5513f99..fe83eb648b 100644 --- a/lib/mbfile.h +++ b/lib/mbfile.h @@ -64,6 +64,11 @@ _GL_INLINE_HEADER_BEGIN # define MBFILE_INLINE _GL_INLINE #endif +#ifdef __cplusplus +extern "C" { +#endif + + struct mbfile_multi { FILE *fp; bool eof_seen; @@ -262,6 +267,11 @@ typedef mbchar_t mbf_char_t; #define mb_iseof(mbc) ((mbc).bytes == 0) + +#ifdef __cplusplus +} +#endif + _GL_INLINE_HEADER_END #endif /* _MBFILE_H */ diff --git a/lib/mbiter.h b/lib/mbiter.h index cb7950df41..bee76d2f81 100644 --- a/lib/mbiter.h +++ b/lib/mbiter.h @@ -101,6 +101,11 @@ _GL_INLINE_HEADER_BEGIN # define MBITER_INLINE _GL_INLINE _GL_ATTRIBUTE_ALWAYS_INLINE #endif +#ifdef __cplusplus +extern "C" { +#endif + + struct mbiter_multi { const char *limit; /* pointer to end of string */ @@ -263,6 +268,11 @@ typedef struct mbiter_multi mbi_iterator_t; /* Copying an iterator. */ #define mbi_copy mbiter_multi_copy + +#ifdef __cplusplus +} +#endif + _GL_INLINE_HEADER_END #endif /* _MBITER_H */ diff --git a/lib/mbiterf.h b/lib/mbiterf.h index 28d2f8ce02..c57815c5b0 100644 --- a/lib/mbiterf.h +++ b/lib/mbiterf.h @@ -92,6 +92,11 @@ _GL_INLINE_HEADER_BEGIN # define MBITERF_INLINE _GL_INLINE _GL_ATTRIBUTE_ALWAYS_INLINE #endif +#ifdef __cplusplus +extern "C" { +#endif + + struct mbif_state { #if !GNULIB_MBRTOC32_REGULAR @@ -199,6 +204,11 @@ typedef struct mbif_state mbif_state_t; #define mbif_next(st, iter, endptr) \ mbiterf_next (&(st), (iter), (endptr)) + +#ifdef __cplusplus +} +#endif + _GL_INLINE_HEADER_END #endif /* _MBITERF_H */ diff --git a/lib/mbuiter.h b/lib/mbuiter.h index 9af3c98e73..1860311d4c 100644 --- a/lib/mbuiter.h +++ b/lib/mbuiter.h @@ -110,6 +110,11 @@ _GL_INLINE_HEADER_BEGIN # define MBUITER_INLINE _GL_INLINE _GL_ATTRIBUTE_ALWAYS_INLINE #endif +#ifdef __cplusplus +extern "C" { +#endif + + struct mbuiter_multi { #if !GNULIB_MBRTOC32_REGULAR @@ -262,6 +267,11 @@ typedef struct mbuiter_multi mbui_iterator_t; /* Copying an iterator. */ #define mbui_copy mbuiter_multi_copy + +#ifdef __cplusplus +} +#endif + _GL_INLINE_HEADER_END #endif /* _MBUITER_H */ diff --git a/lib/mbuiterf.h b/lib/mbuiterf.h index 22e84627d7..1814e35b9d 100644 --- a/lib/mbuiterf.h +++ b/lib/mbuiterf.h @@ -101,6 +101,11 @@ _GL_INLINE_HEADER_BEGIN # define MBUITERF_INLINE _GL_INLINE _GL_ATTRIBUTE_ALWAYS_INLINE #endif +#ifdef __cplusplus +extern "C" { +#endif + + struct mbuif_state { #if !GNULIB_MBRTOC32_REGULAR @@ -208,6 +213,11 @@ typedef struct mbuif_state mbuif_state_t; #define mbuif_next(st, iter) \ mbuiterf_next (&(st), (iter)) + +#ifdef __cplusplus +} +#endif + _GL_INLINE_HEADER_END #endif /* _MBUITERF_H */ diff --git a/lib/mcel.h b/lib/mcel.h index f6f006c900..7d92d24601 100644 --- a/lib/mcel.h +++ b/lib/mcel.h @@ -98,6 +98,16 @@ #include #include +_GL_INLINE_HEADER_BEGIN +#ifndef MCEL_INLINE +# define MCEL_INLINE _GL_INLINE +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + /* Pacify GCC re type limits. */ #if defined __GNUC__ && 4 < __GNUC__ + (3 <= __GNUC_MINOR__) # pragma GCC diagnostic ignored "-Wtype-limits" @@ -147,11 +157,6 @@ static_assert (CHAR_BIT == 8); # define _GL_UNLIKELY(cond) __builtin_expect ((cond), 0) #endif -_GL_INLINE_HEADER_BEGIN -#ifndef MCEL_INLINE -# define MCEL_INLINE _GL_INLINE -#endif - /* mcel_t constructors. */ MCEL_INLINE mcel_t mcel_ch (char32_t ch, size_t len) @@ -291,6 +296,11 @@ mcel_scanz (char const *p) return mcel_scant (p, '\0'); } + +#ifdef __cplusplus +} +#endif + _GL_INLINE_HEADER_END #endif /* _MCEL_H */ diff --git a/lib/memcasecmp.h b/lib/memcasecmp.h index 185552850a..992768cf4a 100644 --- a/lib/memcasecmp.h +++ b/lib/memcasecmp.h @@ -24,4 +24,14 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + int memcasecmp (const void *vs1, const void *vs2, size_t n) _GL_ATTRIBUTE_PURE; + + +#ifdef __cplusplus +} +#endif diff --git a/lib/memcoll.h b/lib/memcoll.h index db180b08db..587a6c234b 100644 --- a/lib/memcoll.h +++ b/lib/memcoll.h @@ -18,11 +18,21 @@ /* Contributed by Paul Eggert . */ #ifndef MEMCOLL_H_ -# define MEMCOLL_H_ 1 +#define MEMCOLL_H_ 1 + +#include + +#ifdef __cplusplus +extern "C" { +#endif -# include int memcoll (char *restrict, size_t, char *restrict, size_t); int memcoll0 (char const *, size_t, char const *, size_t); + +#ifdef __cplusplus +} +#endif + #endif /* MEMCOLL_H_ */ diff --git a/lib/memxor.h b/lib/memxor.h index b250c62ee7..9d0c1f13c0 100644 --- a/lib/memxor.h +++ b/lib/memxor.h @@ -18,15 +18,25 @@ in Niels Möller's Nettle. */ #ifndef MEMXOR_H -# define MEMXOR_H +#define MEMXOR_H #include +#ifdef __cplusplus +extern "C" { +#endif + + /* Compute binary exclusive OR of memory areas DEST and SRC, putting the result in DEST, of length N bytes. Returns a pointer to DEST. */ void *memxor (void *restrict dest, const void *restrict src, size_t n); + +#ifdef __cplusplus +} +#endif + #endif /* MEMXOR_H */ /* diff --git a/lib/mgetgroups.h b/lib/mgetgroups.h index 58fd1a61c4..2cfdfe9e3f 100644 --- a/lib/mgetgroups.h +++ b/lib/mgetgroups.h @@ -16,7 +16,17 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + int mgetgroups (const char *username, gid_t gid, gid_t **groups); #if GNULIB_XGETGROUPS int xgetgroups (const char *username, gid_t gid, gid_t **groups); #endif + + +#ifdef __cplusplus +} +#endif diff --git a/lib/mkdir-p.h b/lib/mkdir-p.h index 1a10bc308a..92850560c3 100644 --- a/lib/mkdir-p.h +++ b/lib/mkdir-p.h @@ -20,6 +20,11 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + struct savewd; bool make_dir_parents (char *dir, struct savewd *wd, @@ -32,3 +37,8 @@ bool make_dir_parents (char *dir, uid_t owner, gid_t group, bool preserve_existing); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/modechange.h b/lib/modechange.h index 3ee0bdec9d..633a72620c 100644 --- a/lib/modechange.h +++ b/lib/modechange.h @@ -17,15 +17,20 @@ along with this program. If not, see . */ #if ! defined MODECHANGE_H_ -# define MODECHANGE_H_ +#define MODECHANGE_H_ /* This file uses _GL_ATTRIBUTE_MALLOC. */ -# if !_GL_CONFIG_H_INCLUDED -# error "Please include config.h first." -# endif +#if !_GL_CONFIG_H_INCLUDED +# error "Please include config.h first." +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif -# include -# include struct mode_change *mode_compile (const char *) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; @@ -35,4 +40,9 @@ mode_t mode_adjust (mode_t, bool, mode_t, struct mode_change const *, mode_t *) _GL_ATTRIBUTE_PURE; + +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/mountlist.h b/lib/mountlist.h index 70b572a698..9728e38b77 100644 --- a/lib/mountlist.h +++ b/lib/mountlist.h @@ -17,14 +17,19 @@ along with this program. If not, see . */ #ifndef MOUNTLIST_H_ -# define MOUNTLIST_H_ +#define MOUNTLIST_H_ /* This file uses _GL_ATTRIBUTE_MALLOC. */ -# if !_GL_CONFIG_H_INCLUDED -# error "Please include config.h first." -# endif +#if !_GL_CONFIG_H_INCLUDED +# error "Please include config.h first." +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif -# include /* A mount table entry. */ struct mount_entry @@ -45,4 +50,9 @@ struct mount_entry *read_file_system_list (bool need_fs_type) _GL_ATTRIBUTE_MALLOC; void free_mount_entry (struct mount_entry *entry); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/mpsort.h b/lib/mpsort.h index 6d135a5e0e..0e0b5f7a20 100644 --- a/lib/mpsort.h +++ b/lib/mpsort.h @@ -17,4 +17,14 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + void mpsort (void const **, size_t, int (*) (void const *, void const *)); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/msvc-nothrow.h b/lib/msvc-nothrow.h index dc6dd35d58..121773d1a7 100644 --- a/lib/msvc-nothrow.h +++ b/lib/msvc-nothrow.h @@ -35,6 +35,10 @@ /* Get original declaration of _get_osfhandle. */ # include +# ifdef __cplusplus +extern "C" { +# endif + # if HAVE_MSVC_INVALID_PARAMETER_HANDLER /* Override _get_osfhandle. */ @@ -43,6 +47,10 @@ extern intptr_t _gl_nothrow_get_osfhandle (int fd); # endif +# ifdef __cplusplus +} +# endif + #endif #endif /* _MSVC_NOTHROW_H */ diff --git a/lib/nan.h b/lib/nan.h index d540a0bb84..70fe813757 100644 --- a/lib/nan.h +++ b/lib/nan.h @@ -17,7 +17,6 @@ #ifndef _GL_NAN_H #define _GL_NAN_H - /* IBM z/OS supports both hexadecimal and IEEE floating-point formats. The former does not support NaN and its isnan() implementation returns zero for all values. */ @@ -25,6 +24,11 @@ # error "NaN is not supported with IBM's hexadecimal floating-point format; please re-compile with -qfloat=ieee" #endif +#ifdef __cplusplus +extern "C" { +#endif + + /* NaNf () returns a 'float' not-a-number. */ /* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler choke @@ -94,4 +98,8 @@ NaNl () #endif +#ifdef __cplusplus +} +#endif + #endif /* _GL_NAN_H */ diff --git a/lib/openat-priv.h b/lib/openat-priv.h index 7fd4beb5a7..63093f4597 100644 --- a/lib/openat-priv.h +++ b/lib/openat-priv.h @@ -24,6 +24,11 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + + /* Maximum number of bytes that it is safe to allocate as a single array on the stack, and that is known as a compile-time constant. The assumption is that we'll touch the array very quickly, or a @@ -61,4 +66,9 @@ int at_func2 (int fd1, char const *file1, int fd2, char const *file2, int (*func) (char const *file1, char const *file2)); + +#ifdef __cplusplus +} +#endif + #endif /* _GL_HEADER_OPENAT_PRIV */ diff --git a/lib/openat.h b/lib/openat.h index dc34092bb3..b6b94f68c7 100644 --- a/lib/openat.h +++ b/lib/openat.h @@ -33,6 +33,11 @@ _GL_INLINE_HEADER_BEGIN +#ifdef __cplusplus +extern "C" { +#endif + + #if !HAVE_OPENAT int openat_permissive (int fd, char const *file, int flags, mode_t mode, @@ -122,6 +127,11 @@ lstatat (int fd, char const *name, struct stat *st) wrappers are not provided for accessat or euidaccessat, so as to avoid dragging in -lgen on some platforms. */ + +#ifdef __cplusplus +} +#endif + _GL_INLINE_HEADER_END #endif /* _GL_HEADER_OPENAT */ diff --git a/lib/opendirat.h b/lib/opendirat.h index f34291902d..618fc00829 100644 --- a/lib/opendirat.h +++ b/lib/opendirat.h @@ -22,5 +22,15 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + DIR *opendirat (int, char const *, int, int *) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/pagealign_alloc.h b/lib/pagealign_alloc.h index b45796c31d..5460d79cc4 100644 --- a/lib/pagealign_alloc.h +++ b/lib/pagealign_alloc.h @@ -16,16 +16,21 @@ along with this program. If not, see . */ #ifndef _PAGEALIGN_ALLOC_H -# define _PAGEALIGN_ALLOC_H +#define _PAGEALIGN_ALLOC_H /* This file uses _GL_ATTRIBUTE_ALLOC_SIZE, _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_NONNULL, _GL_ATTRIBUTE_RETURNS_NONNULL. */ -# if !_GL_CONFIG_H_INCLUDED -# error "Please include config.h first." -# endif +#if !_GL_CONFIG_H_INCLUDED +# error "Please include config.h first." +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif -# include /* Free a memory block. PTR must be a non-NULL pointer returned by pagealign_alloc or @@ -49,4 +54,9 @@ extern void *pagealign_xalloc (size_t size) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (pagealign_free, 1) _GL_ATTRIBUTE_ALLOC_SIZE ((1)) _GL_ATTRIBUTE_RETURNS_NONNULL; + +#ifdef __cplusplus +} +#endif + #endif /* _PAGEALIGN_ALLOC_H */ diff --git a/lib/parse-datetime.h b/lib/parse-datetime.h index 9a980f5baa..784041f7b0 100644 --- a/lib/parse-datetime.h +++ b/lib/parse-datetime.h @@ -18,6 +18,11 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + bool parse_datetime (struct timespec *restrict, char const *, struct timespec const *); @@ -28,3 +33,8 @@ bool parse_datetime (struct timespec *restrict, bool parse_datetime2 (struct timespec *restrict, char const *, struct timespec const *, unsigned int flags, timezone_t, char const *); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/parse-duration.h b/lib/parse-duration.h index b49a3dcb88..bdd3dcb3aa 100644 --- a/lib/parse-duration.h +++ b/lib/parse-duration.h @@ -79,6 +79,11 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + /* Return value when a valid duration cannot be parsed. */ #define BAD_TIME ((time_t)~0) @@ -87,4 +92,9 @@ and errno is set to either EINVAL (bad syntax) or ERANGE (out of range). */ extern time_t parse_duration (char const * in_pz); + +#ifdef __cplusplus +} +#endif + #endif /* GNULIB_PARSE_DURATION_H */ diff --git a/lib/physmem.h b/lib/physmem.h index e471e82f5b..957e629180 100644 --- a/lib/physmem.h +++ b/lib/physmem.h @@ -20,7 +20,17 @@ #ifndef PHYSMEM_H_ # define PHYSMEM_H_ 1 +#ifdef __cplusplus +extern "C" { +#endif + + double physmem_total (void); double physmem_available (void); + +#ifdef __cplusplus +} +#endif + #endif /* PHYSMEM_H_ */ diff --git a/lib/posixtm.h b/lib/posixtm.h index f6b677da7e..74b4abea8f 100644 --- a/lib/posixtm.h +++ b/lib/posixtm.h @@ -19,20 +19,30 @@ Rewritten by Jim Meyering. */ #ifndef POSIXTM_H_ -# define POSIXTM_H_ +#define POSIXTM_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif -# include /* POSIX Date Syntax flags. */ -# define PDS_TRAILING_YEAR 1 -# define PDS_CENTURY 2 -# define PDS_SECONDS 4 -# define PDS_PRE_2000 8 +#define PDS_TRAILING_YEAR 1 +#define PDS_CENTURY 2 +#define PDS_SECONDS 4 +#define PDS_PRE_2000 8 /* For compatibility with older versions of this header, in which PDS_LEADING_YEAR had its own bit. */ -# define PDS_LEADING_YEAR 0 +#define PDS_LEADING_YEAR 0 bool posixtime (time_t *p, const char *s, unsigned int syntax_bits); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/posixver.h b/lib/posixver.h index c02be4605d..91ecf15dee 100644 --- a/lib/posixver.h +++ b/lib/posixver.h @@ -15,4 +15,14 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#ifdef __cplusplus +extern "C" { +#endif + + int posix2_version (void); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/printf-frexp.h b/lib/printf-frexp.h index 4970c13727..8467f98bc2 100644 --- a/lib/printf-frexp.h +++ b/lib/printf-frexp.h @@ -14,6 +14,11 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ +#ifdef __cplusplus +extern "C" { +#endif + + /* Write a finite, positive number x as x = mantissa * 2^exp where exp >= DBL_MIN_EXP - 1, @@ -21,3 +26,8 @@ if x is not a denormalized number then mantissa >= 1.0. Store exp in *EXPPTR and return mantissa. */ extern double printf_frexp (double x, int *expptr); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/printf-frexpl.h b/lib/printf-frexpl.h index b1adfd7f27..11562ed373 100644 --- a/lib/printf-frexpl.h +++ b/lib/printf-frexpl.h @@ -14,6 +14,11 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ +#ifdef __cplusplus +extern "C" { +#endif + + /* Write a finite, positive number x as x = mantissa * 2^exp where exp >= LDBL_MIN_EXP - 1, @@ -21,3 +26,8 @@ if x is not a denormalized number then mantissa >= 1.0. Store exp in *EXPPTR and return mantissa. */ extern long double printf_frexpl (long double x, int *expptr); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/priv-set.h b/lib/priv-set.h index 3f040e9e27..6201b74180 100644 --- a/lib/priv-set.h +++ b/lib/priv-set.h @@ -32,6 +32,11 @@ _GL_INLINE_HEADER_BEGIN # include +# ifdef __cplusplus +extern "C" { +# endif + + int priv_set_ismember (const char *priv); int priv_set_remove (const char *priv); int priv_set_restore (const char *priv); @@ -62,6 +67,11 @@ priv_set_restore_linkdir (void) return -1; } + +# ifdef __cplusplus +} +# endif + #endif _GL_INLINE_HEADER_END diff --git a/lib/quote.h b/lib/quote.h index 2a1c58131b..f087a8548a 100644 --- a/lib/quote.h +++ b/lib/quote.h @@ -16,9 +16,14 @@ along with this program. If not, see . */ #ifndef QUOTE_H_ -# define QUOTE_H_ 1 +#define QUOTE_H_ 1 + +#include + +#ifdef __cplusplus +extern "C" { +#endif -# include /* The quoting options used by quote_n and quote. Its type is incomplete, so it's useful only in expressions like '"e_quoting_options'. */ @@ -43,4 +48,9 @@ char const *quote_n (int n, char const *arg); diagnostics. */ char const *quote (char const *arg); + +#ifdef __cplusplus +} +#endif + #endif /* !QUOTE_H_ */ diff --git a/lib/quotearg.h b/lib/quotearg.h index 202b79f33e..e525b9a01d 100644 --- a/lib/quotearg.h +++ b/lib/quotearg.h @@ -19,14 +19,19 @@ /* Written by Paul Eggert */ #ifndef QUOTEARG_H_ -# define QUOTEARG_H_ 1 +#define QUOTEARG_H_ 1 /* This file uses _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_RETURNS_NONNULL. */ -# if !_GL_CONFIG_H_INCLUDED -# error "Please include config.h first." -# endif +#if !_GL_CONFIG_H_INCLUDED +# error "Please include config.h first." +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif -# include /* Basic quoting styles. For each style, an example is given on the input strings "simple", "\0 \t\n'\"\033?""?/\\", and "a:b", using @@ -270,9 +275,9 @@ enum quoting_flags }; /* For now, --quoting-style=literal is the default, but this may change. */ -# ifndef DEFAULT_QUOTING_STYLE -# define DEFAULT_QUOTING_STYLE literal_quoting_style -# endif +#ifndef DEFAULT_QUOTING_STYLE +# define DEFAULT_QUOTING_STYLE literal_quoting_style +#endif /* Names of quoting styles and their corresponding values. */ extern char const *const quoting_style_args[]; @@ -439,4 +444,9 @@ char *quotearg_custom_mem (char const *left_quote, /* Free any dynamically allocated memory. */ void quotearg_free (void); + +#ifdef __cplusplus +} +#endif + #endif /* !QUOTEARG_H_ */ diff --git a/lib/read-file.h b/lib/read-file.h index 97909ea794..e91699f550 100644 --- a/lib/read-file.h +++ b/lib/read-file.h @@ -29,6 +29,11 @@ /* Get FILE. */ #include +#ifdef __cplusplus +extern "C" { +#endif + + /* Indicate that the file is treated as binary. */ #define RF_BINARY 0x1 @@ -41,4 +46,9 @@ extern char *fread_file (FILE * stream, int flags, size_t * length) extern char *read_file (const char *filename, int flags, size_t * length) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; + +#ifdef __cplusplus +} +#endif + #endif /* READ_FILE_H */ diff --git a/lib/readline.h b/lib/readline.h index 8e099659e6..b4941df015 100644 --- a/lib/readline.h +++ b/lib/readline.h @@ -30,12 +30,22 @@ # include #else # include + +# ifdef __cplusplus +extern "C" { +# endif + /* Prints a prompt PROMPT and then reads and returns a single line of text from the user. If PROMPT is NULL or the empty string, no prompt is displayed. The returned line is allocated with malloc; the caller should free the line when it has finished with it. */ extern char *readline (const char *prompt) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; + +# ifdef __cplusplus +} +# endif + #endif #endif /* GL_READLINE_H */ diff --git a/lib/readtokens.h b/lib/readtokens.h index e0dcc19e18..7514308114 100644 --- a/lib/readtokens.h +++ b/lib/readtokens.h @@ -23,6 +23,11 @@ # include +#ifdef __cplusplus +extern "C" { +#endif + + /* FIXME: This header should use idx_t, not size_t. */ struct tokenbuffer @@ -42,4 +47,9 @@ size_t const char *delim, size_t n_delim, char ***tokens_out, size_t **token_lengths); + +#ifdef __cplusplus +} +#endif + #endif /* not READTOKENS_H */ diff --git a/lib/readtokens0.h b/lib/readtokens0.h index 8c80bcae90..e135dfcb7b 100644 --- a/lib/readtokens0.h +++ b/lib/readtokens0.h @@ -18,11 +18,16 @@ Written by Jim Meyering. */ #ifndef READTOKENS0_H -# define READTOKENS0_H 1 +#define READTOKENS0_H 1 + +#include +#include +#include "obstack.h" + +#ifdef __cplusplus +extern "C" { +#endif -# include -# include -# include "obstack.h" struct Tokens { @@ -38,4 +43,9 @@ void readtokens0_init (struct Tokens *t); void readtokens0_free (struct Tokens *t); bool readtokens0 (FILE *in, struct Tokens *t); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/regex-quote.h b/lib/regex-quote.h index 017915ec01..fe271e303d 100644 --- a/lib/regex-quote.h +++ b/lib/regex-quote.h @@ -25,6 +25,11 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + /* Specifies a quotation task for converting a fixed string to a regular expression pattern. */ struct regex_quote_spec @@ -90,4 +95,8 @@ extern char * _GL_ATTRIBUTE_RETURNS_NONNULL; +#ifdef __cplusplus +} +#endif + #endif /* _REGEX_QUOTE_H */ diff --git a/lib/renameatu.h b/lib/renameatu.h index 1be335b63b..cf97b7136f 100644 --- a/lib/renameatu.h +++ b/lib/renameatu.h @@ -19,6 +19,12 @@ /* Get RENAME_* macros from if present, otherwise supply the traditional Linux values. */ #include + +#ifdef __cplusplus +extern "C" { +#endif + + #ifndef RENAME_NOREPLACE # define RENAME_NOREPLACE (1 << 0) # define RENAME_EXCHANGE (1 << 1) @@ -26,3 +32,8 @@ #endif extern int renameatu (int, char const *, int, char const *, unsigned int); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/rijndael-alg-fst.h b/lib/rijndael-alg-fst.h index 47c4d24cc8..780c9fcca3 100644 --- a/lib/rijndael-alg-fst.h +++ b/lib/rijndael-alg-fst.h @@ -49,6 +49,11 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + + #define RIJNDAEL_MAXKC (256/32) #define RIJNDAEL_MAXKB (256/8) #define RIJNDAEL_MAXNR 14 @@ -62,4 +67,9 @@ void rijndaelEncrypt (const uint32_t rk[ /*4*(Nr + 1) */ ], size_t Nr, void rijndaelDecrypt (const uint32_t rk[ /*4*(Nr + 1) */ ], size_t Nr, const char ct[16], char pt[16]); + +#ifdef __cplusplus +} +#endif + #endif /* __RIJNDAEL_ALG_FST_H */ diff --git a/lib/rijndael-api-fst.h b/lib/rijndael-api-fst.h index 2d6a2accdd..002fc5834e 100644 --- a/lib/rijndael-api-fst.h +++ b/lib/rijndael-api-fst.h @@ -62,6 +62,11 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + /* Default number of bits in a cipher block */ #define RIJNDAEL_BITSPERBLOCK 128 @@ -202,4 +207,9 @@ rijndaelPadDecrypt (rijndaelCipherInstance *cipher, const char *input, size_t inputOctets, char *restrict outBuffer); + +#ifdef __cplusplus +} +#endif + #endif /* __RIJNDAEL_API_FST_H */ diff --git a/lib/safe-alloc.h b/lib/safe-alloc.h index f7b0e5fb51..bee973ed4d 100644 --- a/lib/safe-alloc.h +++ b/lib/safe-alloc.h @@ -36,6 +36,11 @@ _GL_INLINE_HEADER_BEGIN # define SAFE_ALLOC_INLINE _GL_INLINE #endif +#ifdef __cplusplus +extern "C" { +#endif + + /* Don't call these directly - use the macros below. */ SAFE_ALLOC_INLINE void * safe_alloc_realloc_n (void *ptr, size_t count, size_t size) @@ -121,6 +126,11 @@ safe_alloc_check (void *ptr) */ #define FREE(ptr) ((void) (free (ptr), (ptr) = NULL)) + +#ifdef __cplusplus +} +#endif + _GL_INLINE_HEADER_END #endif /* SAFE_ALLOC_H_ */ diff --git a/lib/safe-write.h b/lib/safe-write.h index c10a9ae455..4415dd0513 100644 --- a/lib/safe-write.h +++ b/lib/safe-write.h @@ -29,9 +29,19 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + #define SAFE_WRITE_ERROR ((size_t) -1) /* Write up to COUNT bytes at BUF to descriptor FD, retrying if interrupted. Return the actual number of bytes written, zero for EOF, or SAFE_WRITE_ERROR upon error. */ extern size_t safe_write (int fd, const void *buf, size_t count); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/same-inode.h b/lib/same-inode.h index 62dd088e53..13ae24b71b 100644 --- a/lib/same-inode.h +++ b/lib/same-inode.h @@ -30,6 +30,11 @@ _GL_INLINE_HEADER_BEGIN # define SAME_INODE_INLINE _GL_INLINE #endif +#ifdef __cplusplus +extern "C" { +#endif + + /* True if A and B point to structs with st_dev and st_ino members that are known to represent the same file. @@ -80,6 +85,11 @@ psame_inode (struct stat const *a, struct stat const *b) return PSAME_INODE (a, b); } + +#ifdef __cplusplus +} +#endif + _GL_INLINE_HEADER_END #endif diff --git a/lib/same.h b/lib/same.h index efd2433f96..87ef6fec56 100644 --- a/lib/same.h +++ b/lib/same.h @@ -16,9 +16,19 @@ along with this program. If not, see . */ #ifndef SAME_H_ -# define SAME_H_ 1 +#define SAME_H_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + bool same_name (const char *source, const char *dest); bool same_nameat (int, char const *, int, char const *); + +#ifdef __cplusplus +} +#endif + #endif /* SAME_H_ */ diff --git a/lib/save-cwd.h b/lib/save-cwd.h index 692e4b97be..9d314c2cf4 100644 --- a/lib/save-cwd.h +++ b/lib/save-cwd.h @@ -19,7 +19,12 @@ /* Written by Jim Meyering. */ #ifndef SAVE_CWD_H -# define SAVE_CWD_H 1 +#define SAVE_CWD_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + struct saved_cwd { @@ -31,4 +36,9 @@ int save_cwd (struct saved_cwd *cwd); int restore_cwd (const struct saved_cwd *cwd); void free_cwd (struct saved_cwd *cwd); + +#ifdef __cplusplus +} +#endif + #endif /* SAVE_CWD_H */ diff --git a/lib/savedir.h b/lib/savedir.h index c292b270f0..02f21576f7 100644 --- a/lib/savedir.h +++ b/lib/savedir.h @@ -29,6 +29,11 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + + enum savedir_option { SAVEDIR_SORT_NONE, @@ -46,4 +51,9 @@ char *streamsavedir (DIR *, enum savedir_option) char *savedir (char const *, enum savedir_option) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; + +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/savewd.h b/lib/savewd.h index b79fcec3eb..e74ba82d94 100644 --- a/lib/savewd.h +++ b/lib/savewd.h @@ -32,6 +32,11 @@ _GL_INLINE_HEADER_BEGIN # define SAVEWD_INLINE _GL_INLINE #endif +#ifdef __cplusplus +extern "C" { +#endif + + /* A saved working directory. The member names and constants defined by this structure are private to the savewd module. */ struct savewd @@ -149,6 +154,11 @@ int savewd_process_files (int n_files, char **file, int (*act) (char *, struct savewd *, void *), void *options); + +#ifdef __cplusplus +} +#endif + _GL_INLINE_HEADER_END #endif diff --git a/lib/selinux-at.h b/lib/selinux-at.h index 5cb00e3c0f..c25e362c5d 100644 --- a/lib/selinux-at.h +++ b/lib/selinux-at.h @@ -17,6 +17,11 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + + /* These are the dir-fd-relative variants of the functions without the "at" suffix. For example, getfileconat (AT_FDCWD, file, &c) is usually equivalent to getfilecon (file, &c). The emulation is accomplished @@ -50,3 +55,8 @@ int setfileconat (int dir_fd, char const *file, char const *con); except when DIR_FD and FILE specify a symlink: lsetfileconat operates on the symlink, while setfileconat operates on the referent of the symlink. */ int lsetfileconat (int dir_fd, char const *file, char const *con); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/signed-nan.h b/lib/signed-nan.h index 18a550a751..14d2c525f5 100644 --- a/lib/signed-nan.h +++ b/lib/signed-nan.h @@ -21,6 +21,10 @@ #include "nan.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Returns a quiet 'float' NaN with sign bit == 0. */ _GL_UNUSED static float @@ -85,4 +89,8 @@ negative_NaNl () } +#ifdef __cplusplus +} +#endif + #endif /* _SIGNED_NAN_H */ diff --git a/lib/signed-snan.h b/lib/signed-snan.h index 7e6483a761..89ba721009 100644 --- a/lib/signed-snan.h +++ b/lib/signed-snan.h @@ -20,6 +20,10 @@ #include "signed-nan.h" #include "snan.h" +#ifdef __cplusplus +extern "C" { +#endif + #if HAVE_SNANF @@ -139,4 +143,8 @@ negative_SNaNl () #endif +#ifdef __cplusplus +} +#endif + #endif /* _SIGNED_SNAN_H */ diff --git a/lib/snan.h b/lib/snan.h index 9523504046..c7312e259f 100644 --- a/lib/snan.h +++ b/lib/snan.h @@ -23,6 +23,10 @@ #include "nan.h" +#ifdef __cplusplus +extern "C" { +#endif + /* The bit that distinguishes a quiet NaN from a signalling NaN is, according to , the most significant bit of the @@ -273,4 +277,8 @@ SNaNl () #undef NWORDS +#ifdef __cplusplus +} +#endif + #endif /* _SNAN_H */ diff --git a/lib/sockets.h b/lib/sockets.h index 99d6efca52..55077ae98a 100644 --- a/lib/sockets.h +++ b/lib/sockets.h @@ -25,6 +25,10 @@ #error "Please include config.h first." #endif +#ifdef __cplusplus +extern "C" { +#endif + #define SOCKETS_1_0 0x0001 #define SOCKETS_1_1 0x0101 #define SOCKETS_2_0 0x0002 @@ -43,6 +47,11 @@ int gl_sockets_cleanup (void) #endif ; +#ifdef __cplusplus +} +#endif + + /* This function is useful it you create a socket using gnulib's Winsock wrappers but needs to pass on the socket handle to some other library that only accepts sockets. */ diff --git a/lib/stdio-safer.h b/lib/stdio-safer.h index 03d1545667..8e2e777d6f 100644 --- a/lib/stdio-safer.h +++ b/lib/stdio-safer.h @@ -24,6 +24,11 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + #if GNULIB_FOPEN_SAFER FILE *fopen_safer (char const *, char const *) _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1); @@ -43,3 +48,8 @@ FILE *popen_safer (char const *, char const *) FILE *tmpfile_safer (void) _GL_ATTRIBUTE_DEALLOC (fclose, 1); #endif + + +#ifdef __cplusplus +} +#endif diff --git a/lib/stdlib-safer.h b/lib/stdlib-safer.h index d47d1640ed..07357d9116 100644 --- a/lib/stdlib-safer.h +++ b/lib/stdlib-safer.h @@ -17,6 +17,11 @@ /* Written by Paul Eggert. */ +#ifdef __cplusplus +extern "C" { +#endif + + int mkstemp_safer (char *); #if GNULIB_MKOSTEMP @@ -30,3 +35,8 @@ int mkostemps_safer (char *, int, int); #if GNULIB_MKSTEMPS int mkstemps_safer (char *, int); #endif + + +#ifdef __cplusplus +} +#endif diff --git a/lib/streq.h b/lib/streq.h index 123434637f..8593de6dff 100644 --- a/lib/streq.h +++ b/lib/streq.h @@ -21,6 +21,11 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + /* STREQ_OPT allows to optimize string comparison with a small literal string. STREQ_OPT (s, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0) is semantically equivalent to @@ -173,4 +178,9 @@ streq0 (const char *s1, const char *s2, char s20, char s21, char s22, char s23, #endif + +#ifdef __cplusplus +} +#endif + #endif /* _GL_STREQ_H */ diff --git a/lib/strerror-override.h b/lib/strerror-override.h index 872fa7d6c7..a1734a242e 100644 --- a/lib/strerror-override.h +++ b/lib/strerror-override.h @@ -16,47 +16,57 @@ along with this program. If not, see . */ #ifndef _GL_STRERROR_OVERRIDE_H -# define _GL_STRERROR_OVERRIDE_H +#define _GL_STRERROR_OVERRIDE_H /* This file uses _GL_ATTRIBUTE_CONST. */ -# if !_GL_CONFIG_H_INCLUDED -# error "Please include config.h first." -# endif +#if !_GL_CONFIG_H_INCLUDED +# error "Please include config.h first." +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif -# include -# include /* Reasonable buffer size that should never trigger ERANGE; if this proves too small, we intentionally abort(), to remind us to fix this value. */ -# define STACKBUF_LEN 256 +#define STACKBUF_LEN 256 /* If ERRNUM maps to an errno value defined by gnulib, return a string describing the error. Otherwise return NULL. */ -# if REPLACE_STRERROR_0 \ - || GNULIB_defined_ESOCK \ - || GNULIB_defined_ESTREAMS \ - || GNULIB_defined_EWINSOCK \ - || GNULIB_defined_ENOMSG \ - || GNULIB_defined_EIDRM \ - || GNULIB_defined_ENOLINK \ - || GNULIB_defined_EPROTO \ - || GNULIB_defined_EMULTIHOP \ - || GNULIB_defined_EBADMSG \ - || GNULIB_defined_EOVERFLOW \ - || GNULIB_defined_ENOTSUP \ - || GNULIB_defined_ENETRESET \ - || GNULIB_defined_ECONNABORTED \ - || GNULIB_defined_ESTALE \ - || GNULIB_defined_EDQUOT \ - || GNULIB_defined_ECANCELED \ - || GNULIB_defined_EOWNERDEAD \ - || GNULIB_defined_ENOTRECOVERABLE \ - || GNULIB_defined_EILSEQ +#if REPLACE_STRERROR_0 \ + || GNULIB_defined_ESOCK \ + || GNULIB_defined_ESTREAMS \ + || GNULIB_defined_EWINSOCK \ + || GNULIB_defined_ENOMSG \ + || GNULIB_defined_EIDRM \ + || GNULIB_defined_ENOLINK \ + || GNULIB_defined_EPROTO \ + || GNULIB_defined_EMULTIHOP \ + || GNULIB_defined_EBADMSG \ + || GNULIB_defined_EOVERFLOW \ + || GNULIB_defined_ENOTSUP \ + || GNULIB_defined_ENETRESET \ + || GNULIB_defined_ECONNABORTED \ + || GNULIB_defined_ESTALE \ + || GNULIB_defined_EDQUOT \ + || GNULIB_defined_ECANCELED \ + || GNULIB_defined_EOWNERDEAD \ + || GNULIB_defined_ENOTRECOVERABLE \ + || GNULIB_defined_EILSEQ extern const char *strerror_override (int errnum) _GL_ATTRIBUTE_CONST; -# else -# define strerror_override(ignored) NULL -# define GNULIB_defined_strerror_override_macro 1 -# endif +#else +# define strerror_override(ignored) NULL +# define GNULIB_defined_strerror_override_macro 1 +#endif + + +#ifdef __cplusplus +} +#endif #endif /* _GL_STRERROR_OVERRIDE_H */ diff --git a/lib/tmpdir.h b/lib/tmpdir.h index ffbf34088b..f5493aed77 100644 --- a/lib/tmpdir.h +++ b/lib/tmpdir.h @@ -16,6 +16,11 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + /* Path search algorithm, for tmpnam, tmpfile, etc. If DIR is non-null and exists, uses it; otherwise uses the first of $TMPDIR, P_tmpdir, /tmp that exists. Copies into TMPL a template suitable @@ -23,3 +28,8 @@ doesn't exist, none of the searched dirs exists, or there's not enough space in TMPL. */ extern int path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx, bool try_tmpdir); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/trim.h b/lib/trim.h index 5a0cdf3d22..33a5feef53 100644 --- a/lib/trim.h +++ b/lib/trim.h @@ -23,6 +23,11 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + /* Trim mode. */ #define TRIM_TRAILING 0 #define TRIM_LEADING 1 @@ -40,3 +45,8 @@ char *trim2 (const char *, int) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_RETURNS_NONNULL; + + +#ifdef __cplusplus +} +#endif diff --git a/lib/u64.h b/lib/u64.h index 63339cca0f..4eca03e985 100644 --- a/lib/u64.h +++ b/lib/u64.h @@ -29,6 +29,11 @@ _GL_INLINE_HEADER_BEGIN # define _GL_U64_INLINE _GL_INLINE #endif +#ifdef __cplusplus +extern "C" { +#endif + + /* Return X rotated left by N bits, where 0 < N < 64. */ #define u64rol(x, n) u64or (u64shl (x, n), u64shr (x, 64 - n)) @@ -178,4 +183,9 @@ u64shr (u64 x, int n) #endif + +#ifdef __cplusplus +} +#endif + _GL_INLINE_HEADER_END diff --git a/lib/unicase/casefold.h b/lib/unicase/casefold.h index 647e05fc99..bb320678c4 100644 --- a/lib/unicase/casefold.h +++ b/lib/unicase/casefold.h @@ -25,6 +25,16 @@ #include "unitypes.h" +#ifdef __cplusplus +extern "C" { +#endif + + /* Return the casefold mapping of a Unicode character. */ extern ucs4_t uc_tocasefold (ucs4_t uc); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/unicase/caseprop.h b/lib/unicase/caseprop.h index ac7646890c..d6b95bd1e5 100644 --- a/lib/unicase/caseprop.h +++ b/lib/unicase/caseprop.h @@ -25,6 +25,11 @@ #include "unitypes.h" +#ifdef __cplusplus +extern "C" { +#endif + + /* Determine whether a character is "cased" according to the Unicode Standard, , section 3.13, definition D120. */ @@ -39,3 +44,8 @@ extern bool extern bool uc_is_case_ignorable (ucs4_t uc) _UC_ATTRIBUTE_CONST; + + +#ifdef __cplusplus +} +#endif diff --git a/lib/unicase/invariant.h b/lib/unicase/invariant.h index e0ec3a33e9..136c630198 100644 --- a/lib/unicase/invariant.h +++ b/lib/unicase/invariant.h @@ -28,6 +28,11 @@ #include "unitypes.h" #include "uninorm.h" +#ifdef __cplusplus +extern "C" { +#endif + + /* Return true if mapping NFD(S) to via MAPPING is a no-op. */ extern int u8_is_invariant (const uint8_t *s, size_t n, @@ -50,3 +55,8 @@ extern int uint32_t *resultbuf, size_t *lengthp), const char *iso639_language, bool *resultp); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/unicase/special-casing.in.h b/lib/unicase/special-casing.in.h index 5683a45278..db8b843847 100644 --- a/lib/unicase/special-casing.in.h +++ b/lib/unicase/special-casing.in.h @@ -25,6 +25,11 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + /* A special casing context. A context is negated through x -> -x. */ enum @@ -67,3 +72,8 @@ struct special_casing_rule extern const struct special_casing_rule * gl_unicase_special_lookup (const char *str, size_t len); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/unicase/unicasemap.h b/lib/unicase/unicasemap.h index 783b393030..6783b9b340 100644 --- a/lib/unicase/unicasemap.h +++ b/lib/unicase/unicasemap.h @@ -29,6 +29,11 @@ #include "unicase.h" #include "uninorm.h" +#ifdef __cplusplus +extern "C" { +#endif + + extern uint8_t * u8_casemap (const uint8_t *s, size_t n, casing_prefix_context_t prefix_context, @@ -58,3 +63,8 @@ extern uint32_t * size_t offset_in_rule, /* offset in 'struct special_casing_rule' */ uninorm_t nf, uint32_t *resultbuf, size_t *lengthp); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/unicodeio.h b/lib/unicodeio.h index 3c36d08e67..0db1d35f52 100644 --- a/lib/unicodeio.h +++ b/lib/unicodeio.h @@ -16,10 +16,15 @@ along with this program. If not, see . */ #ifndef UNICODEIO_H -# define UNICODEIO_H +#define UNICODEIO_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif -# include -# include /* Converts the Unicode character CODE to its multibyte representation in the current locale and calls the SUCCESS callback on the resulting @@ -45,4 +50,9 @@ extern void print_unicode_char (FILE *stream, unsigned int code, extern long fwrite_success_callback (const char *buf, size_t buflen, void *callback_arg); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/unilbrk/lbrktables.h b/lib/unilbrk/lbrktables.h index 85116575c6..5166d43030 100644 --- a/lib/unilbrk/lbrktables.h +++ b/lib/unilbrk/lbrktables.h @@ -25,6 +25,11 @@ #include "unitypes.h" +#ifdef __cplusplus +extern "C" { +#endif + + /* Line breaking classification. */ enum @@ -119,3 +124,8 @@ extern const unsigned char unilbrk_table[40][40]; /* We don't support line breaking of complex-context dependent characters (Thai, Lao, Myanmar, Khmer) yet, because it requires dictionary lookup. */ + + +#ifdef __cplusplus +} +#endif diff --git a/lib/unilbrk/ulc-common.h b/lib/unilbrk/ulc-common.h index d2d9f2ec12..a3f713d9a4 100644 --- a/lib/unilbrk/ulc-common.h +++ b/lib/unilbrk/ulc-common.h @@ -28,6 +28,11 @@ #include "c-ctype.h" +#ifdef __cplusplus +extern "C" { +#endif + + #define is_utf8_encoding unilbrk_is_utf8_encoding extern int is_utf8_encoding (const char *encoding); @@ -37,3 +42,8 @@ extern int is_utf8_encoding (const char *encoding); extern int is_all_ascii (const char *s, size_t n); #endif /* C_CTYPE_ASCII */ + + +#ifdef __cplusplus +} +#endif diff --git a/lib/uninorm/decompose-internal.h b/lib/uninorm/decompose-internal.h index b96404041a..c68671e56c 100644 --- a/lib/uninorm/decompose-internal.h +++ b/lib/uninorm/decompose-internal.h @@ -19,6 +19,11 @@ #include "unitypes.h" +#ifdef __cplusplus +extern "C" { +#endif + + /* Variant of uc_decomposition that does not produce the 'tag'. */ extern int uc_compat_decomposition (ucs4_t uc, ucs4_t *decomposition); @@ -34,3 +39,8 @@ struct ucs4_with_ccc extern void gl_uninorm_decompose_merge_sort_inplace (struct ucs4_with_ccc *src, size_t n, struct ucs4_with_ccc *tmp); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/unistd-safer.h b/lib/unistd-safer.h index c117926706..70562c919a 100644 --- a/lib/unistd-safer.h +++ b/lib/unistd-safer.h @@ -17,6 +17,11 @@ /* Written by Paul Eggert and Eric Blake. */ +#ifdef __cplusplus +extern "C" { +#endif + + int dup_safer (int); int fd_safer (int); int pipe_safer (int[2]); @@ -29,3 +34,8 @@ int fd_safer_flag (int, int); #if GNULIB_PIPE2_SAFER int pipe2_safer (int[2], int); #endif + + +#ifdef __cplusplus +} +#endif diff --git a/lib/unitypes.in.h b/lib/unitypes.in.h index 1b14d3b631..16010d3796 100644 --- a/lib/unitypes.in.h +++ b/lib/unitypes.in.h @@ -20,6 +20,11 @@ /* Get uint8_t, uint16_t, uint32_t. */ #include +#ifdef __cplusplus +extern "C" { +#endif + + /* Type representing a Unicode character. */ typedef uint32_t ucs4_t; @@ -58,4 +63,9 @@ typedef uint32_t ucs4_t; # endif #endif + +#ifdef __cplusplus +} +#endif + #endif /* _UNITYPES_H */ diff --git a/lib/uniwbrk/wbrktable.h b/lib/uniwbrk/wbrktable.h index 05374f679c..d24d3caee5 100644 --- a/lib/uniwbrk/wbrktable.h +++ b/lib/uniwbrk/wbrktable.h @@ -23,5 +23,13 @@ License and of the GNU General Public License along with this program. If not, see . */ +#ifdef __cplusplus +extern "C" { +#endif + extern const int uniwbrk_prop_index[23]; extern const unsigned char uniwbrk_table[12][12]; + +#ifdef __cplusplus +} +#endif diff --git a/lib/unlinkdir.h b/lib/unlinkdir.h index 955ea48b86..a142f23689 100644 --- a/lib/unlinkdir.h +++ b/lib/unlinkdir.h @@ -17,8 +17,16 @@ /* Written by Paul Eggert and Jim Meyering. */ +#ifdef __cplusplus +extern "C" { +#endif + #if UNLINK_CANNOT_UNLINK_DIR # define cannot_unlink_dir() true #else bool cannot_unlink_dir (void); #endif + +#ifdef __cplusplus +} +#endif diff --git a/lib/userspec.h b/lib/userspec.h index edf911e3f1..dff2309a61 100644 --- a/lib/userspec.h +++ b/lib/userspec.h @@ -17,9 +17,14 @@ /* Written by Jim Meyering, 2003. */ #ifndef USERSPEC_H -# define USERSPEC_H 1 +#define USERSPEC_H 1 + +#include + +#ifdef __cplusplus +extern "C" { +#endif -# include char const * parse_user_spec (char const *spec_arg, uid_t *uid, gid_t *gid, @@ -28,4 +33,9 @@ char const * parse_user_spec_warn (char const *spec_arg, uid_t *uid, gid_t *gid, char **username_arg, char **groupname_arg, bool *pwarn); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/utimecmp.h b/lib/utimecmp.h index bf730cb07c..6af5b0bcbc 100644 --- a/lib/utimecmp.h +++ b/lib/utimecmp.h @@ -23,6 +23,11 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + + /* Options for utimecmp. */ enum { @@ -36,4 +41,9 @@ int utimecmp (char const *, struct stat const *, struct stat const *, int); int utimecmpat (int, char const *, struct stat const *, struct stat const *, int); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/utimens.h b/lib/utimens.h index 7c740afd36..b20d4f4f7e 100644 --- a/lib/utimens.h +++ b/lib/utimens.h @@ -23,11 +23,22 @@ #endif #include + +#ifdef __cplusplus +extern "C" { +#endif + int fdutimens (int, char const *, struct timespec const [2]); int utimens (char const *, struct timespec const [2]); int lutimens (char const *, struct timespec const [2]); +#ifdef __cplusplus +} +#endif + + #if GNULIB_FDUTIMENSAT + # include # include @@ -36,6 +47,10 @@ _GL_INLINE_HEADER_BEGIN # define _GL_UTIMENS_INLINE _GL_INLINE #endif +#ifdef __cplusplus +extern "C" { +#endif + int fdutimensat (int fd, int dir, char const *name, struct timespec const [2], int atflag); @@ -46,6 +61,10 @@ lutimensat (int dir, char const *file, struct timespec const times[2]) return utimensat (dir, file, times, AT_SYMLINK_NOFOLLOW); } +#ifdef __cplusplus +} +#endif + _GL_INLINE_HEADER_END #endif diff --git a/lib/windows-spawn.h b/lib/windows-spawn.h index a48b976530..9f18ab2a64 100644 --- a/lib/windows-spawn.h +++ b/lib/windows-spawn.h @@ -31,6 +31,11 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter @@ -187,4 +192,9 @@ extern intptr_t spawnpvech (int mode, HANDLE stdin_handle, HANDLE stdout_handle, HANDLE stderr_handle); + +#ifdef __cplusplus +} +#endif + #endif /* _WINDOWS_SPAWN_H */ diff --git a/lib/write-any-file.h b/lib/write-any-file.h index 959fe267b3..412b981f17 100644 --- a/lib/write-any-file.h +++ b/lib/write-any-file.h @@ -15,4 +15,14 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#ifdef __cplusplus +extern "C" { +#endif + + bool can_write_any_file (void); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/xbinary-io.h b/lib/xbinary-io.h index 67d3334ce2..52310e0de1 100644 --- a/lib/xbinary-io.h +++ b/lib/xbinary-io.h @@ -29,6 +29,11 @@ _GL_INLINE_HEADER_BEGIN # define XBINARY_IO_INLINE _GL_INLINE #endif +#ifdef __cplusplus +extern "C" { +#endif + + #if O_BINARY extern _Noreturn void xset_binary_mode_error (void); #else @@ -45,6 +50,11 @@ xset_binary_mode (int fd, int mode) xset_binary_mode_error (); } + +#ifdef __cplusplus +} +#endif + _GL_INLINE_HEADER_END #endif /* _XBINARY_IO_H */ diff --git a/lib/xgetcwd.h b/lib/xgetcwd.h index 425ea16fdf..67749af7ad 100644 --- a/lib/xgetcwd.h +++ b/lib/xgetcwd.h @@ -21,5 +21,15 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + extern char *xgetcwd (void) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; + + +#ifdef __cplusplus +} +#endif diff --git a/lib/xgetdomainname.h b/lib/xgetdomainname.h index 28db1ea581..526d1a71c7 100644 --- a/lib/xgetdomainname.h +++ b/lib/xgetdomainname.h @@ -25,6 +25,11 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + /* Return the NIS domain name of the machine, in malloc'd storage. WARNING! The NIS domain name is unrelated to the fully qualified host name of the machine. It is also unrelated to email addresses. @@ -35,4 +40,9 @@ extern char *xgetdomainname (void) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; + +#ifdef __cplusplus +} +#endif + #endif /* _XGETDOMAINNAME_H */ diff --git a/lib/xgethostname.h b/lib/xgethostname.h index 6f0d6b0059..4e293dc1a1 100644 --- a/lib/xgethostname.h +++ b/lib/xgethostname.h @@ -22,5 +22,15 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + char *xgethostname (void) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; + + +#ifdef __cplusplus +} +#endif diff --git a/lib/xmemcoll.h b/lib/xmemcoll.h index 13b6a02cb9..9a5994885f 100644 --- a/lib/xmemcoll.h +++ b/lib/xmemcoll.h @@ -17,5 +17,15 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + int xmemcoll (char *restrict, size_t, char *restrict, size_t); int xmemcoll0 (char const *, size_t, char const *, size_t); + + +#ifdef __cplusplus +} +#endif diff --git a/lib/xprintf.h b/lib/xprintf.h index 9e7d1e802a..202dbd2022 100644 --- a/lib/xprintf.h +++ b/lib/xprintf.h @@ -25,6 +25,11 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + + extern int xprintf (char const *restrict format, ...) #if GNULIB_VPRINTF_POSIX _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 1, 2)) @@ -58,4 +63,9 @@ extern int xvfprintf (FILE *restrict stream, char const *restrict format, #endif ; + +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/xreadlink.h b/lib/xreadlink.h index 6dce9bcc29..bfce10a3bd 100644 --- a/lib/xreadlink.h +++ b/lib/xreadlink.h @@ -25,6 +25,11 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + extern char *xreadlink (char const *filename) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; @@ -32,3 +37,8 @@ extern char *xreadlink (char const *filename) extern char *xreadlinkat (int fd, char const *filename) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; #endif + + +#ifdef __cplusplus +} +#endif diff --git a/lib/xsize.h b/lib/xsize.h index 71c9c07322..619c0edc2b 100644 --- a/lib/xsize.h +++ b/lib/xsize.h @@ -40,6 +40,11 @@ _GL_INLINE_HEADER_BEGIN # define XSIZE_INLINE _GL_INLINE #endif +#ifdef __cplusplus +extern "C" { +#endif + + /* The size of memory objects is often computed through expressions of type size_t. Example: void* p = malloc (header_size + n * element_size). @@ -105,6 +110,11 @@ xmax (size_t size1, size_t size2) #define size_in_bounds_p(SIZE) \ ((SIZE) != SIZE_MAX) + +#ifdef __cplusplus +} +#endif + _GL_INLINE_HEADER_END #endif /* _XSIZE_H */ diff --git a/lib/xstrndup.h b/lib/xstrndup.h index d54d5bb0fa..272265e66d 100644 --- a/lib/xstrndup.h +++ b/lib/xstrndup.h @@ -22,9 +22,19 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + /* Return a newly allocated copy of at most N bytes of STRING. In other words, return a copy of the initial segment of length N of STRING. */ extern char *xstrndup (const char *string, size_t n) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_RETURNS_NONNULL; + + +#ifdef __cplusplus +} +#endif diff --git a/lib/xstrtod.h b/lib/xstrtod.h index 0780f5fe14..9ae4be13da 100644 --- a/lib/xstrtod.h +++ b/lib/xstrtod.h @@ -19,11 +19,21 @@ /* Written by Jim Meyering. */ #ifndef XSTRTOD_H -# define XSTRTOD_H 1 +#define XSTRTOD_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + bool xstrtod (const char *str, const char **ptr, double *result, double (*convert) (char const *, char **)); bool xstrtold (const char *str, const char **ptr, long double *result, long double (*convert) (char const *, char **)); + +#ifdef __cplusplus +} +#endif + #endif /* not XSTRTOD_H */ diff --git a/lib/xstrtol.h b/lib/xstrtol.h index 44b1cb47a3..280c1f3a43 100644 --- a/lib/xstrtol.h +++ b/lib/xstrtol.h @@ -17,12 +17,17 @@ along with this program. If not, see . */ #ifndef XSTRTOL_H_ -# define XSTRTOL_H_ 1 +#define XSTRTOL_H_ 1 /* Get intmax_t, uintmax_t. */ -# include +#include -# ifndef _STRTOL_ERROR +#ifdef __cplusplus +extern "C" { +#endif + + +#ifndef _STRTOL_ERROR enum strtol_error { LONGINT_OK = 0, @@ -37,9 +42,9 @@ enum strtol_error LONGINT_INVALID = 4 }; typedef enum strtol_error strtol_error; -# endif +#endif -# define _DECLARE_XSTRTOL(name, type) \ +#define _DECLARE_XSTRTOL(name, type) \ strtol_error name (const char *, char **, int, type *, const char *); _DECLARE_XSTRTOL (xstrtol, long int) _DECLARE_XSTRTOL (xstrtoul, unsigned long int) @@ -48,4 +53,9 @@ _DECLARE_XSTRTOL (xstrtoull, unsigned long long int) _DECLARE_XSTRTOL (xstrtoimax, intmax_t) _DECLARE_XSTRTOL (xstrtoumax, uintmax_t) + +#ifdef __cplusplus +} +#endif + #endif /* not XSTRTOL_H_ */ diff --git a/lib/yesno.h b/lib/yesno.h index 14a86585dd..81c0eca2e9 100644 --- a/lib/yesno.h +++ b/lib/yesno.h @@ -17,6 +17,16 @@ #ifndef YESNO_H_ # define YESNO_H_ +#ifdef __cplusplus +extern "C" { +#endif + + bool yesno (void); + +#ifdef __cplusplus +} +#endif + #endif -- 2.34.1