From: Gary Lockyer Date: Mon, 19 May 2025 02:35:43 +0000 (+1200) Subject: Fix clang 20 shadows variable in global scope warning X-Git-Tag: tevent-0.17.0~86 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eb76e600c4346a92528c701c76a5300cbbd0bf74;p=thirdparty%2Fsamba.git Fix clang 20 shadows variable in global scope warning Fixes: [4822/4916] Compiling source3/torture/torture.c ../../source3/torture/torture.c:685:6: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] 685 | int timezone = smb1cli_conn_server_time_zone(cli->conn); | ^ /usr/include/time.h:234:17: note: previous declaration is here 234 | extern long int timezone; | ^ 1 error generated. Signed-off-by: Gary Lockyer Reviewed-by: Douglas Bagnall Reviewed-by: Anoop C S --- diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py index bcf909e1a93..586b789a923 100644 --- a/buildtools/wafsamba/samba_autoconf.py +++ b/buildtools/wafsamba/samba_autoconf.py @@ -846,7 +846,6 @@ int main(void) { conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Wno-error=sometimes-uninitialized', testflags=True) conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Wno-error=cast-qual', testflags=True) conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Wno-error=format-nonliteral', testflags=True) - conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Wno-error=shadow', testflags=True) if Options.options.fatal_errors: conf.ADD_CFLAGS('-Wfatal-errors', testflags=True) diff --git a/source3/torture/torture.c b/source3/torture/torture.c index f70f5c575b1..4864535ebd1 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -682,7 +682,7 @@ NTSTATUS cli_qpathinfo1(struct cli_state *cli, off_t *size, uint32_t *pattr) { - int timezone = smb1cli_conn_server_time_zone(cli->conn); + int tz = smb1cli_conn_server_time_zone(cli->conn); time_t (*date_fn)(const void *buf, int serverzone) = NULL; uint8_t *rdata = NULL; uint32_t num_rdata; @@ -706,13 +706,13 @@ NTSTATUS cli_qpathinfo1(struct cli_state *cli, } if (change_time) { - *change_time = date_fn(rdata + 0, timezone); + *change_time = date_fn(rdata + 0, tz); } if (access_time) { - *access_time = date_fn(rdata + 4, timezone); + *access_time = date_fn(rdata + 4, tz); } if (write_time) { - *write_time = date_fn(rdata + 8, timezone); + *write_time = date_fn(rdata + 8, tz); } if (size) { *size = PULL_LE_U32(rdata, 12);