public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] fixincludes/fixfixes.c: Fix 'set but not used' warning.
@ 2020-09-11 12:21 Christophe Lyon
  2020-09-17  4:16 ` Jeff Law
  0 siblings, 1 reply; 3+ messages in thread
From: Christophe Lyon @ 2020-09-11 12:21 UTC (permalink / raw)
  To: gcc-patches, bkorb

pz_tmp_base and pz_tmp_dot are always set, but used only when
_PC_NAME_MAX is defined.

This patch moves their declaration and definition undef #ifdef
_PC_NAME_MAX to avoid this warning.

2020-09-11  Torbjörn SVENSSON  <torbjorn.svensson@st.com>
	Christophe Lyon  <christophe.lyon@linaro.org>

	fixincludes/
	* fixfixes.c (pz_tmp_base, pz_tmp_dot): Define only with
	_PC_NAME_MAX.
---
 fixincludes/fixfixes.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fixincludes/fixfixes.c b/fixincludes/fixfixes.c
index 034e15d..5b23a8b 100644
--- a/fixincludes/fixfixes.c
+++ b/fixincludes/fixfixes.c
@@ -738,8 +738,10 @@ main( int argc, char** argv )
 {
   tFixDesc* pFix;
   char* pz_tmptmp;
+#ifdef _PC_NAME_MAX
   char* pz_tmp_base;
   char* pz_tmp_dot;
+#endif
 
   if (argc != 5)
     {
@@ -772,12 +774,12 @@ main( int argc, char** argv )
   pz_tmptmp = XNEWVEC (char, strlen (argv[4]) + 5);
   strcpy( pz_tmptmp, argv[4] );
 
+#ifdef _PC_NAME_MAX
   /* Don't lose because "12345678" and "12345678X" map to the same
      file under DOS restricted 8+3 file namespace.  Note that DOS
      doesn't allow more than one dot in the trunk of a file name.  */
   pz_tmp_base = basename( pz_tmptmp );
   pz_tmp_dot = strchr( pz_tmp_base, '.' );
-#ifdef _PC_NAME_MAX
   if (pathconf( pz_tmptmp, _PC_NAME_MAX ) <= 12	/* is this DOS or Windows9X? */
       && pz_tmp_dot != (char*)NULL)
     strcpy (pz_tmp_dot+1, "X"); /* nuke the original extension */
-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fixincludes/fixfixes.c: Fix 'set but not used' warning.
  2020-09-11 12:21 [PATCH] fixincludes/fixfixes.c: Fix 'set but not used' warning Christophe Lyon
@ 2020-09-17  4:16 ` Jeff Law
  2020-09-17  9:37   ` Christophe Lyon
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Law @ 2020-09-17  4:16 UTC (permalink / raw)
  To: Christophe Lyon, gcc-patches, bkorb

[-- Attachment #1: Type: text/plain, Size: 541 bytes --]


On 9/11/20 6:21 AM, Christophe Lyon via Gcc-patches wrote:
> pz_tmp_base and pz_tmp_dot are always set, but used only when
> _PC_NAME_MAX is defined.
>
> This patch moves their declaration and definition undef #ifdef
> _PC_NAME_MAX to avoid this warning.
>
> 2020-09-11  Torbjörn SVENSSON  <torbjorn.svensson@st.com>
> 	Christophe Lyon  <christophe.lyon@linaro.org>
>
> 	fixincludes/
> 	* fixfixes.c (pz_tmp_base, pz_tmp_dot): Define only with
> 	_PC_NAME_MAX.

OK.  I assume Christophe can commit the change.


Jeff


[-- Attachment #2: pEpkey.asc --]
[-- Type: application/pgp-keys, Size: 1763 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fixincludes/fixfixes.c: Fix 'set but not used' warning.
  2020-09-17  4:16 ` Jeff Law
@ 2020-09-17  9:37   ` Christophe Lyon
  0 siblings, 0 replies; 3+ messages in thread
From: Christophe Lyon @ 2020-09-17  9:37 UTC (permalink / raw)
  To: Jeff Law; +Cc: gcc Patches, bkorb

On Thu, 17 Sep 2020 at 06:16, Jeff Law <law@redhat.com> wrote:
>
>
> On 9/11/20 6:21 AM, Christophe Lyon via Gcc-patches wrote:
> > pz_tmp_base and pz_tmp_dot are always set, but used only when
> > _PC_NAME_MAX is defined.
> >
> > This patch moves their declaration and definition undef #ifdef
> > _PC_NAME_MAX to avoid this warning.
> >
> > 2020-09-11  Torbjörn SVENSSON  <torbjorn.svensson@st.com>
> >       Christophe Lyon  <christophe.lyon@linaro.org>
> >
> >       fixincludes/
> >       * fixfixes.c (pz_tmp_base, pz_tmp_dot): Define only with
> >       _PC_NAME_MAX.
>
> OK.  I assume Christophe can commit the change.

Sure, just pushed.

Thanks

Christophe

>
>
> Jeff
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-17  9:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-11 12:21 [PATCH] fixincludes/fixfixes.c: Fix 'set but not used' warning Christophe Lyon
2020-09-17  4:16 ` Jeff Law
2020-09-17  9:37   ` Christophe Lyon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).