Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 528a9ab

Browse files
committed
Don't use defined() in C preprocessor macros
The ICC compiler doesn't seem to support defined() in macro expansion. Example of warning: warning #3199: "defined" is always false in a macro expansion in Microsoft mode
1 parent 479fea6 commit 528a9ab

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

Modules/posixmodule.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4781,9 +4781,7 @@ typedef struct {
47814781
} \
47824782

47834783

4784-
#define UTIME_HAVE_DIR_FD (defined(HAVE_FUTIMESAT) || defined(HAVE_UTIMENSAT))
4785-
4786-
#if UTIME_HAVE_DIR_FD
4784+
#if defined(HAVE_FUTIMESAT) || defined(HAVE_UTIMENSAT)
47874785

47884786
static int
47894787
utime_dir_fd(utime_t *ut, int dir_fd, char *path, int follow_symlinks)
@@ -4806,9 +4804,7 @@ utime_dir_fd(utime_t *ut, int dir_fd, char *path, int follow_symlinks)
48064804

48074805
#endif
48084806

4809-
#define UTIME_HAVE_FD (defined(HAVE_FUTIMES) || defined(HAVE_FUTIMENS))
4810-
4811-
#if UTIME_HAVE_FD
4807+
#if defined(HAVE_FUTIMES) || defined(HAVE_FUTIMENS)
48124808

48134809
static int
48144810
utime_fd(utime_t *ut, int fd)
@@ -4912,14 +4908,14 @@ posix_utime(PyObject *self, PyObject *args, PyObject *kwargs)
49124908
memset(&path, 0, sizeof(path));
49134909
path.function_name = "utime";
49144910
memset(&utime, 0, sizeof(utime_t));
4915-
#if UTIME_HAVE_FD
4911+
#if defined(HAVE_FUTIMES) || defined(HAVE_FUTIMENS)
49164912
path.allow_fd = 1;
49174913
#endif
49184914
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
49194915
"O&|O$OO&p:utime", keywords,
49204916
path_converter, &path,
49214917
&times, &ns,
4922-
#if UTIME_HAVE_DIR_FD
4918+
#if defined(HAVE_FUTIMESAT) || defined(HAVE_UTIMENSAT)
49234919
dir_fd_converter, &dir_fd,
49244920
#else
49254921
dir_fd_unavailable, &dir_fd,
@@ -5035,13 +5031,13 @@ posix_utime(PyObject *self, PyObject *args, PyObject *kwargs)
50355031
else
50365032
#endif
50375033

5038-
#if UTIME_HAVE_DIR_FD
5034+
#if defined(HAVE_FUTIMESAT) || defined(HAVE_UTIMENSAT)
50395035
if ((dir_fd != DEFAULT_DIR_FD) || (!follow_symlinks))
50405036
result = utime_dir_fd(&utime, dir_fd, path.narrow, follow_symlinks);
50415037
else
50425038
#endif
50435039

5044-
#if UTIME_HAVE_FD
5040+
#if defined(HAVE_FUTIMES) || defined(HAVE_FUTIMENS)
50455041
if (path.fd != -1)
50465042
result = utime_fd(&utime, path.fd);
50475043
else

0 commit comments

Comments
 (0)