From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by sourceware.org (Postfix) with ESMTPS id 0F2D8398B44A for ; Thu, 1 Oct 2020 14:19:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0F2D8398B44A Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 091EHSgP027717 for ; Thu, 1 Oct 2020 16:19:30 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 33v0dh5vd1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 01 Oct 2020 16:19:30 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id A7CFA10002A for ; Thu, 1 Oct 2020 16:19:29 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag1node1.st.com [10.75.127.1]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 9F0C82B1510 for ; Thu, 1 Oct 2020 16:19:29 +0200 (CEST) Received: from localhost (10.75.127.45) by SFHDAG1NODE1.st.com (10.75.127.1) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 1 Oct 2020 16:19:29 +0200 From: =?UTF-8?q?Torbj=C3=B6rn=20SVENSSON?= To: Subject: [PATCH 3/3] libc: Replace one letter member names in __tzrule_struct Date: Thu, 1 Oct 2020 16:17:53 +0200 Message-ID: <20201001141753.6657-4-torbjorn.svensson@st.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20201001141753.6657-1-torbjorn.svensson@st.com> References: <20201001141753.6657-1-torbjorn.svensson@st.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.75.127.45] X-ClientProxiedBy: SFHDAG2NODE2.st.com (10.75.127.5) To SFHDAG1NODE1.st.com (10.75.127.1) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-10-01_04:2020-10-01, 2020-10-01 signatures=0 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2020 14:19:32 -0000 As discussed in GCC bug 97088 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97088), parameters in prototypes of library functions should use reserved names, or no name at all. This patch replaces 'm', 'n', 'd' and 's' members in 'struct __tzrule_struct' to avoid possible clashes with user code in case someone uses before including Newlib's time.h (or uses some other conflicting definition) Signed-off-by: Torbjörn SVENSSON --- newlib/libc/include/time.h | 8 ++++---- newlib/libc/time/tzcalc_limits.c | 14 +++++++------- newlib/libc/time/tzset_r.c | 22 +++++++++++----------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/newlib/libc/include/time.h b/newlib/libc/include/time.h index 3031590b4..6a540537f 100644 --- a/newlib/libc/include/time.h +++ b/newlib/libc/include/time.h @@ -105,10 +105,10 @@ void _tzset_r (struct _reent *); typedef struct __tzrule_struct { char ch; - int m; - int n; - int d; - int s; + int month; /* Month of year if ch=M */ + int week; /* Week of month if ch=M */ + int day; /* Day of week if ch=M, day of year if ch=J or ch=D */ + int secs; /* Time of day in seconds */ time_t change; long offset; /* Match type of _timezone. */ } __tzrule_type; diff --git a/newlib/libc/time/tzcalc_limits.c b/newlib/libc/time/tzcalc_limits.c index e0ea6549c..b2163ed3d 100644 --- a/newlib/libc/time/tzcalc_limits.c +++ b/newlib/libc/time/tzcalc_limits.c @@ -34,13 +34,13 @@ __tzcalc_limits (int year) if (tz->__tzrule[i].ch == 'J') { /* The Julian day n (1 <= n <= 365). */ - days = year_days + tz->__tzrule[i].d + - (isleap(year) && tz->__tzrule[i].d >= 60); + days = year_days + tz->__tzrule[i].day + + (isleap(year) && tz->__tzrule[i].day >= 60); /* Convert to yday */ --days; } else if (tz->__tzrule[i].ch == 'D') - days = year_days + tz->__tzrule[i].d; + days = year_days + tz->__tzrule[i].day; else { const int yleap = isleap(year); @@ -49,15 +49,15 @@ __tzcalc_limits (int year) days = year_days; - for (j = 1; j < tz->__tzrule[i].m; ++j) + for (j = 1; j < tz->__tzrule[i].month; ++j) days += ip[j-1]; m_wday = (EPOCH_WDAY + days) % DAYSPERWEEK; - wday_diff = tz->__tzrule[i].d - m_wday; + wday_diff = tz->__tzrule[i].day - m_wday; if (wday_diff < 0) wday_diff += DAYSPERWEEK; - m_day = (tz->__tzrule[i].n - 1) * DAYSPERWEEK + wday_diff; + m_day = (tz->__tzrule[i].week - 1) * DAYSPERWEEK + wday_diff; while (m_day >= ip[j-1]) m_day -= DAYSPERWEEK; @@ -67,7 +67,7 @@ __tzcalc_limits (int year) /* store the change-over time in GMT form by adding offset */ tz->__tzrule[i].change = days * SECSPERDAY + - tz->__tzrule[i].s + tz->__tzrule[i].offset; + tz->__tzrule[i].secs + tz->__tzrule[i].offset; } tz->__tznorth = (tz->__tzrule[0].change < tz->__tzrule[1].change); diff --git a/newlib/libc/time/tzset_r.c b/newlib/libc/time/tzset_r.c index 9e0cf834b..7117b51e6 100644 --- a/newlib/libc/time/tzset_r.c +++ b/newlib/libc/time/tzset_r.c @@ -115,9 +115,9 @@ _tzset_unlocked_r (struct _reent *reent_ptr) return; tz->__tzrule[i].ch = 'M'; - tz->__tzrule[i].m = m; - tz->__tzrule[i].n = w; - tz->__tzrule[i].d = d; + tz->__tzrule[i].month = m; + tz->__tzrule[i].week = w; + tz->__tzrule[i].day = d; tzenv += n; } @@ -142,22 +142,22 @@ _tzset_unlocked_r (struct _reent *reent_ptr) if (i == 0) { tz->__tzrule[0].ch = 'M'; - tz->__tzrule[0].m = 3; - tz->__tzrule[0].n = 2; - tz->__tzrule[0].d = 0; + tz->__tzrule[0].month = 3; + tz->__tzrule[0].week = 2; + tz->__tzrule[0].day = 0; } else { tz->__tzrule[1].ch = 'M'; - tz->__tzrule[1].m = 11; - tz->__tzrule[1].n = 1; - tz->__tzrule[1].d = 0; + tz->__tzrule[1].month = 11; + tz->__tzrule[1].week = 1; + tz->__tzrule[1].day = 0; } } else { tz->__tzrule[i].ch = ch; - tz->__tzrule[i].d = d; + tz->__tzrule[i].day = d; } tzenv = end; @@ -172,7 +172,7 @@ _tzset_unlocked_r (struct _reent *reent_ptr) if (*tzenv == '/') sscanf (tzenv, "/%hu%n:%hu%n:%hu%n", &hh, &n, &mm, &n, &ss, &n); - tz->__tzrule[i].s = ss + SECSPERMIN * mm + SECSPERHOUR * hh; + tz->__tzrule[i].secs = ss + SECSPERMIN * mm + SECSPERHOUR * hh; tzenv += n; } -- 2.18.0