* io/bits/fcntl2.h (open, open64, openat, openat64): Add

__extension__ around the whole statement expression.
2007-08-04  Jakub Jelinek  <jakub@redhat.com>

	* io/bits/fcntl2.h (open, open64, openat, openat64): Add
	__extension__ around the whole statement expression.
This commit is contained in:
Jakub Jelinek 2007-08-04 20:09:21 +00:00
parent c8ccd8e3a2
commit 9accc268ff
2 changed files with 129 additions and 116 deletions

View File

@ -1,3 +1,8 @@
2007-08-04 Jakub Jelinek <jakub@redhat.com>
* io/bits/fcntl2.h (open, open64, openat, openat64): Add
__extension__ around the whole statement expression.
2007-08-04 Ulrich Drepper <drepper@redhat.com> 2007-08-04 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/opendir.c (__alloc_dir): Correct order of DIR * sysdeps/unix/opendir.c (__alloc_dir): Correct order of DIR

View File

@ -31,10 +31,11 @@ extern int __REDIRECT (__open_2, (__const char *__file, int __oflag),
#endif #endif
#define open(fname, flags, ...) \ #define open(fname, flags, ...) \
(__extension__ \
({ int ___r; \ ({ int ___r; \
/* If the compiler complains about an invalid type, excess elements, etc \ /* If the compiler complains about an invalid type, excess elements, \
in the initialization this means a parameter of the wrong type has \ etc. in the initialization this means a parameter of the wrong type \
been passed to open. */ \ has been passed to open. */ \
int ___arr[] = { __VA_ARGS__ }; \ int ___arr[] = { __VA_ARGS__ }; \
if (__builtin_constant_p (flags) && ((flags) & O_CREAT) != 0) \ if (__builtin_constant_p (flags) && ((flags) & O_CREAT) != 0) \
{ \ { \
@ -55,21 +56,23 @@ extern int __REDIRECT (__open_2, (__const char *__file, int __oflag),
{ \ { \
/* If the compiler complains about the size of this array type too \ /* If the compiler complains about the size of this array type too \
many parameters have been passed to open. */ \ many parameters have been passed to open. */ \
typedef int __open_too_many_args[-(sizeof (___arr) > sizeof (int))]; \ typedef int __open_too_many_args[-(sizeof (___arr) \
> sizeof (int))]; \
___r = open (fname, flags, ___arr[0]); \ ___r = open (fname, flags, ___arr[0]); \
} \ } \
___r; \ ___r; \
}) }))
#ifdef __USE_LARGEFILE64 #ifdef __USE_LARGEFILE64
extern int __open64_2 (__const char *__path, int __oflag) __nonnull ((1)); extern int __open64_2 (__const char *__path, int __oflag) __nonnull ((1));
# define open64(fname, flags, ...) \ # define open64(fname, flags, ...) \
(__extension__ \
({ int ___r; \ ({ int ___r; \
/* If the compiler complains about an invalid type, excess elements, etc \ /* If the compiler complains about an invalid type, excess elements, \
in the initialization this means a parameter of the wrong type has \ etc. in the initialization this means a parameter of the wrong type \
been passed to open64. */ \ has been passed to open64. */ \
int ___arr[] = { __VA_ARGS__ }; \ int ___arr[] = { __VA_ARGS__ }; \
if (__builtin_constant_p (flags) && ((flags) & O_CREAT) != 0) \ if (__builtin_constant_p (flags) && ((flags) & O_CREAT) != 0) \
{ \ { \
@ -90,11 +93,12 @@ extern int __open64_2 (__const char *__path, int __oflag) __nonnull ((1));
{ \ { \
/* If the compiler complains about the size of this array type too \ /* If the compiler complains about the size of this array type too \
many parameters have been passed to open64. */ \ many parameters have been passed to open64. */ \
typedef int __open_too_many_args[-(sizeof (___arr) > sizeof (int))]; \ typedef int __open_too_many_args[-(sizeof (___arr) \
> sizeof (int))]; \
___r = open64 (fname, flags, ___arr[0]); \ ___r = open64 (fname, flags, ___arr[0]); \
} \ } \
___r; \ ___r; \
}) }))
#endif #endif
#ifdef __USE_ATFILE #ifdef __USE_ATFILE
@ -108,10 +112,11 @@ extern int __REDIRECT (__openat_2, (int __fd, __const char *__file,
# endif # endif
# define openat(fd, fname, flags, ...) \ # define openat(fd, fname, flags, ...) \
(__extension__ \
({ int ___r; \ ({ int ___r; \
/* If the compiler complains about an invalid type, excess elements, etc \ /* If the compiler complains about an invalid type, excess elements, \
in the initialization this means a parameter of the wrong type has \ etc. in the initialization this means a parameter of the wrong type \
been passed to openat. */ \ has been passed to openat. */ \
int ___arr[] = { __VA_ARGS__ }; \ int ___arr[] = { __VA_ARGS__ }; \
if (__builtin_constant_p (flags) && ((flags) & O_CREAT) != 0) \ if (__builtin_constant_p (flags) && ((flags) & O_CREAT) != 0) \
{ \ { \
@ -132,11 +137,12 @@ extern int __REDIRECT (__openat_2, (int __fd, __const char *__file,
{ \ { \
/* If the compiler complains about the size of this array type too \ /* If the compiler complains about the size of this array type too \
many parameters have been passed to openat. */ \ many parameters have been passed to openat. */ \
typedef int __open_too_many_args[-(sizeof (___arr) > sizeof (int))]; \ typedef int __open_too_many_args[-(sizeof (___arr) \
> sizeof (int))]; \
___r = openat (fd, fname, flags, ___arr[0]); \ ___r = openat (fd, fname, flags, ___arr[0]); \
} \ } \
___r; \ ___r; \
}) }))
# ifdef __USE_LARGEFILE64 # ifdef __USE_LARGEFILE64
@ -144,10 +150,11 @@ extern int __openat64_2 (int __fd, __const char *__path, int __oflag)
__nonnull ((2)); __nonnull ((2));
# define openat64(fd, fname, flags, ...) \ # define openat64(fd, fname, flags, ...) \
(__extension__ \
({ int ___r; \ ({ int ___r; \
/* If the compiler complains about an invalid type, excess elements, etc \ /* If the compiler complains about an invalid type, excess elements, \
in the initialization this means a parameter of the wrong type has \ etc. in the initialization this means a parameter of the wrong type \
been passed to openat64. */ \ has been passed to openat64. */ \
int ___arr[] = { __VA_ARGS__ }; \ int ___arr[] = { __VA_ARGS__ }; \
if (__builtin_constant_p (flags) && ((flags) & O_CREAT) != 0) \ if (__builtin_constant_p (flags) && ((flags) & O_CREAT) != 0) \
{ \ { \
@ -168,10 +175,11 @@ extern int __openat64_2 (int __fd, __const char *__path, int __oflag)
{ \ { \
/* If the compiler complains about the size of this array type too \ /* If the compiler complains about the size of this array type too \
many parameters have been passed to openat64. */ \ many parameters have been passed to openat64. */ \
typedef int __open_too_many_args[-(sizeof (___arr) > sizeof (int))]; \ typedef int __open_too_many_args[-(sizeof (___arr) \
> sizeof (int))]; \
___r = openat64 (fd, fname, flags, ___arr[0]); \ ___r = openat64 (fd, fname, flags, ___arr[0]); \
} \ } \
___r; \ ___r; \
}) }))
# endif # endif
#endif #endif