diff mbox series

fixincludes/fixfixes.c: Fix 'set but not used' warning.

Message ID 1599826919-5148-1-git-send-email-christophe.lyon@linaro.org
State New
Headers show
Series fixincludes/fixfixes.c: Fix 'set but not used' warning. | expand

Commit Message

Christophe Lyon Sept. 11, 2020, 12:21 p.m. UTC
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(-)

Comments

Jeff Law Sept. 17, 2020, 4:16 a.m. UTC | #1
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
Christophe Lyon Sept. 17, 2020, 9:37 a.m. UTC | #2
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
>
diff mbox series

Patch

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 */