* 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,70 +31,74 @@ extern int __REDIRECT (__open_2, (__const char *__file, int __oflag),
#endif #endif
#define open(fname, flags, ...) \ #define open(fname, flags, ...) \
({ int ___r; \ (__extension__ \
/* If the compiler complains about an invalid type, excess elements, etc \ ({ int ___r; \
in the initialization this means a parameter of the wrong type has \ /* If the compiler complains about an invalid type, excess elements, \
been passed to open. */ \ etc. in the initialization this means a parameter of the wrong type \
int ___arr[] = { __VA_ARGS__ }; \ has been passed to open. */ \
if (__builtin_constant_p (flags) && ((flags) & O_CREAT) != 0) \ int ___arr[] = { __VA_ARGS__ }; \
{ \ if (__builtin_constant_p (flags) && ((flags) & O_CREAT) != 0) \
/* If the compiler complains about the size of this array type the \ { \
mode parameter is missing since O_CREAT has been used. */ \ /* If the compiler complains about the size of this array type the \
typedef int __open_missing_mode[((flags) & O_CREAT) != 0 \ mode parameter is missing since O_CREAT has been used. */ \
? ((long int) sizeof (___arr) \ typedef int __open_missing_mode[((flags) & O_CREAT) != 0 \
- (long int) sizeof (int)) : 1]; \ ? ((long int) sizeof (___arr) \
} \ - (long int) sizeof (int)) : 1];\
if (sizeof (___arr) == 0) \ } \
{ \ if (sizeof (___arr) == 0) \
if (__builtin_constant_p (flags) && ((flags) & O_CREAT) == 0) \ { \
___r = open (fname, flags); \ if (__builtin_constant_p (flags) && ((flags) & O_CREAT) == 0) \
else \ ___r = open (fname, flags); \
___r = __open_2 (fname, flags); \ else \
} \ ___r = __open_2 (fname, flags); \
else \ } \
{ \ else \
/* If the compiler complains about the size of this array type too \ { \
many parameters have been passed to open. */ \ /* If the compiler complains about the size of this array type too \
typedef int __open_too_many_args[-(sizeof (___arr) > sizeof (int))]; \ many parameters have been passed to open. */ \
___r = open (fname, flags, ___arr[0]); \ typedef int __open_too_many_args[-(sizeof (___arr) \
} \ > sizeof (int))]; \
___r; \ ___r = open (fname, flags, ___arr[0]); \
}) } \
___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, ...) \
({ int ___r; \ (__extension__ \
/* If the compiler complains about an invalid type, excess elements, etc \ ({ int ___r; \
in the initialization this means a parameter of the wrong type has \ /* If the compiler complains about an invalid type, excess elements, \
been passed to open64. */ \ etc. in the initialization this means a parameter of the wrong type \
int ___arr[] = { __VA_ARGS__ }; \ has been passed to open64. */ \
if (__builtin_constant_p (flags) && ((flags) & O_CREAT) != 0) \ int ___arr[] = { __VA_ARGS__ }; \
{ \ if (__builtin_constant_p (flags) && ((flags) & O_CREAT) != 0) \
/* If the compiler complains about the size of this array type the \ { \
mode parameter is missing since O_CREAT has been used. */ \ /* If the compiler complains about the size of this array type the \
typedef int __open_missing_mode[((flags) & O_CREAT) != 0 \ mode parameter is missing since O_CREAT has been used. */ \
? ((long int) sizeof (___arr) \ typedef int __open_missing_mode[((flags) & O_CREAT) != 0 \
- (long int) sizeof (int)) : 1]; \ ? ((long int) sizeof (___arr) \
} \ - (long int) sizeof (int)) : 1];\
if (sizeof (___arr) == 0) \ } \
{ \ if (sizeof (___arr) == 0) \
if (__builtin_constant_p (flags) && ((flags) & O_CREAT) == 0) \ { \
___r = open64 (fname, flags); \ if (__builtin_constant_p (flags) && ((flags) & O_CREAT) == 0) \
else \ ___r = open64 (fname, flags); \
___r = __open64_2 (fname, flags); \ else \
} \ ___r = __open64_2 (fname, flags); \
else \ } \
{ \ else \
/* If the compiler complains about the size of this array type too \ { \
many parameters have been passed to open64. */ \ /* If the compiler complains about the size of this array type too \
typedef int __open_too_many_args[-(sizeof (___arr) > sizeof (int))]; \ many parameters have been passed to open64. */ \
___r = open64 (fname, flags, ___arr[0]); \ typedef int __open_too_many_args[-(sizeof (___arr) \
} \ > sizeof (int))]; \
___r; \ ___r = open64 (fname, flags, ___arr[0]); \
}) } \
___r; \
}))
#endif #endif
#ifdef __USE_ATFILE #ifdef __USE_ATFILE
@ -108,35 +112,37 @@ extern int __REDIRECT (__openat_2, (int __fd, __const char *__file,
# endif # endif
# define openat(fd, fname, flags, ...) \ # define openat(fd, fname, flags, ...) \
({ int ___r; \ (__extension__ \
/* If the compiler complains about an invalid type, excess elements, etc \ ({ int ___r; \
in the initialization this means a parameter of the wrong type has \ /* If the compiler complains about an invalid type, excess elements, \
been passed to openat. */ \ etc. in the initialization this means a parameter of the wrong type \
int ___arr[] = { __VA_ARGS__ }; \ has been passed to openat. */ \
if (__builtin_constant_p (flags) && ((flags) & O_CREAT) != 0) \ int ___arr[] = { __VA_ARGS__ }; \
{ \ if (__builtin_constant_p (flags) && ((flags) & O_CREAT) != 0) \
/* If the compiler complains about the size of this array type the \ { \
mode parameter is missing since O_CREAT has been used. */ \ /* If the compiler complains about the size of this array type the \
typedef int __open_missing_mode[((flags) & O_CREAT) != 0 \ mode parameter is missing since O_CREAT has been used. */ \
? ((long int) sizeof (___arr) \ typedef int __open_missing_mode[((flags) & O_CREAT) != 0 \
- (long int) sizeof (int)) : 1]; \ ? ((long int) sizeof (___arr) \
} \ - (long int) sizeof (int)) : 1];\
if (sizeof (___arr) == 0) \ } \
{ \ if (sizeof (___arr) == 0) \
if (__builtin_constant_p (flags) && ((flags) & O_CREAT) == 0) \ { \
___r = openat (fd, fname, flags); \ if (__builtin_constant_p (flags) && ((flags) & O_CREAT) == 0) \
else \ ___r = openat (fd, fname, flags); \
___r = __openat_2 (fd, fname, flags); \ else \
} \ ___r = __openat_2 (fd, fname, flags); \
else \ } \
{ \ else \
/* If the compiler complains about the size of this array type too \ { \
many parameters have been passed to openat. */ \ /* If the compiler complains about the size of this array type too \
typedef int __open_too_many_args[-(sizeof (___arr) > sizeof (int))]; \ many parameters have been passed to openat. */ \
___r = openat (fd, fname, flags, ___arr[0]); \ typedef int __open_too_many_args[-(sizeof (___arr) \
} \ > sizeof (int))]; \
___r; \ ___r = openat (fd, fname, flags, ___arr[0]); \
}) } \
___r; \
}))
# ifdef __USE_LARGEFILE64 # ifdef __USE_LARGEFILE64
@ -144,34 +150,36 @@ 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, ...) \
({ int ___r; \ (__extension__ \
/* If the compiler complains about an invalid type, excess elements, etc \ ({ int ___r; \
in the initialization this means a parameter of the wrong type has \ /* If the compiler complains about an invalid type, excess elements, \
been passed to openat64. */ \ etc. in the initialization this means a parameter of the wrong type \
int ___arr[] = { __VA_ARGS__ }; \ has been passed to openat64. */ \
if (__builtin_constant_p (flags) && ((flags) & O_CREAT) != 0) \ int ___arr[] = { __VA_ARGS__ }; \
{ \ if (__builtin_constant_p (flags) && ((flags) & O_CREAT) != 0) \
/* If the compiler complains about the size of this array type the \ { \
mode parameter is missing since O_CREAT has been used. */ \ /* If the compiler complains about the size of this array type the \
typedef int __open_missing_mode[((flags) & O_CREAT) != 0 \ mode parameter is missing since O_CREAT has been used. */ \
? ((long int) sizeof (___arr) \ typedef int __open_missing_mode[((flags) & O_CREAT) != 0 \
- (long int) sizeof (int)) : 1]; \ ? ((long int) sizeof (___arr) \
} \ - (long int) sizeof (int)) : 1];\
if (sizeof (___arr) == 0) \ } \
{ \ if (sizeof (___arr) == 0) \
if (__builtin_constant_p (flags) && ((flags) & O_CREAT) == 0) \ { \
___r = openat64 (fd, fname, flags); \ if (__builtin_constant_p (flags) && ((flags) & O_CREAT) == 0) \
else \ ___r = openat64 (fd, fname, flags); \
___r = __openat64_2 (fd, fname, flags); \ else \
} \ ___r = __openat64_2 (fd, fname, flags); \
else \ } \
{ \ else \
/* If the compiler complains about the size of this array type too \ { \
many parameters have been passed to openat64. */ \ /* If the compiler complains about the size of this array type too \
typedef int __open_too_many_args[-(sizeof (___arr) > sizeof (int))]; \ many parameters have been passed to openat64. */ \
___r = openat64 (fd, fname, flags, ___arr[0]); \ typedef int __open_too_many_args[-(sizeof (___arr) \
} \ > sizeof (int))]; \
___r; \ ___r = openat64 (fd, fname, flags, ___arr[0]); \
}) } \
___r; \
}))
# endif # endif
#endif #endif