diff options
author | Bruno Haible <bruno@clisp.org> | 2019-09-15 17:41:29 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2019-09-15 17:41:29 +0200 |
commit | c5f7c7c69b3b986c49930c1c7ac37c552a3be738 (patch) | |
tree | 154ad65d2faf2341dae38d9004ae457327cc4f32 /lib/fcntl.in.h | |
parent | 9e75623a64a07215f2c7811e0356697d6df10fa2 (diff) | |
download | gnulib-c5f7c7c69b3b986c49930c1c7ac37c552a3be738.tar.gz |
creat: New module.
* lib/fcntl.in.h (creat): New declaration.
* lib/creat.c: New file, based on lib/open.c.
* m4/creat.m4: New file.
* m4/open-slash.m4: New file, extracted from m4/open.m4.
* m4/open.m4 (gl_FUNC_OPEN): Move trailing-slash test to open-slash.m4.
Invoke gl_OPEN_TRAILING_SLASH_BUG.
* modules/open (Files): Add m4/open-slash.m4.
* m4/fcntl_h.m4 (gl_FCNTL_H_DEFAULTS): Initialize GNULIB_CREAT,
REPLACE_CREAT.
* modules/fcntl-h (Makefile.am): Substitute GNULIB_CREAT, REPLACE_CREAT.
* modules/creat: New file.
* tests/test-fcntl-h-c++.cc (creat): Check signature.
* doc/posix-functions/creat.texi: Mention the new module.
Diffstat (limited to 'lib/fcntl.in.h')
-rw-r--r-- | lib/fcntl.in.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h index eb70dc61ec..557e6c14b2 100644 --- a/lib/fcntl.in.h +++ b/lib/fcntl.in.h @@ -67,7 +67,7 @@ #endif /* Native Windows platforms declare open(), creat() in <io.h>. */ -#if (@GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \ +#if (@GNULIB_CREAT@ || @GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \ && (defined _WIN32 && ! defined __CYGWIN__) # include <io.h> #endif @@ -82,6 +82,26 @@ /* Declare overridden functions. */ +#if @GNULIB_CREAT@ +# if @REPLACE_CREAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef creat +# define creat rpl_creat +# endif +_GL_FUNCDECL_RPL (creat, int, (const char *filename, mode_t mode) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (creat, int, (const char *filename, mode_t mode)); +# else +_GL_CXXALIAS_SYS (creat, int, (const char *filename, mode_t mode)); +# endif +_GL_CXXALIASWARN (creat); +#elif defined GNULIB_POSIXCHECK +# undef creat +/* Assume creat is always declared. */ +_GL_WARN_ON_USE (creat, "creat is not always POSIX compliant - " + "use gnulib module creat for portability"); +#endif + #if @GNULIB_FCNTL@ # if @REPLACE_FCNTL@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |