diff mbox series

[net-next,2/2] net: rose: Escape trigraph to fix warning with W=1

Message ID 20201028002235.928999-3-andrew@lunn.ch
State Changes Requested
Delegated to: David Miller
Headers show
Series net trigraph fixes for W=1 | expand

Checks

Context Check Description
jkicinski/stable success Stable not CCed
jkicinski/header_inline success Link
jkicinski/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
jkicinski/checkpatch fail Link
jkicinski/verify_fixes success Link
jkicinski/kdoc success Errors and warnings before: 0 this patch: 0
jkicinski/build_32bit fail Errors and warnings before: 4 this patch: 4
jkicinski/module_param success Was 0 now: 0
jkicinski/verify_signedoff success Link
jkicinski/source_inline success Was 0 now: 0
jkicinski/subject_prefix success Link
jkicinski/tree_selection success Clearly marked for net-next
jkicinski/patch_count success Link
jkicinski/fixes_present success Link
jkicinski/cover_letter success Link

Commit Message

Andrew Lunn Oct. 28, 2020, 12:22 a.m. UTC
net/rose/af_rose.c: In function ‘rose_info_show’:
net/rose/af_rose.c:1413:20: warning: trigraph ??- ignored, use -trigraphs to enable [-Wtrigraphs]
 1413 |    callsign = "??????-?";

??- is a trigraph, and should be replaced by a ˜ by the
compiler. However, trigraphs are being ignored in the build. Fix the
warning by escaping the ?? prefix of a trigraph.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 net/rose/af_rose.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Laight Oct. 29, 2020, 2:19 p.m. UTC | #1
From: Andrew Lunn
> Sent: 28 October 2020 00:23
> 
> net/rose/af_rose.c: In function ‘rose_info_show’:
> net/rose/af_rose.c:1413:20: warning: trigraph ??- ignored, use -trigraphs to enable [-Wtrigraphs]
>  1413 |    callsign = "??????-?";
> 
> ??- is a trigraph, and should be replaced by a ˜ by the
> compiler. However, trigraphs are being ignored in the build. Fix the
> warning by escaping the ?? prefix of a trigraph.
> 
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> ---
>  net/rose/af_rose.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
> index cf7d974e0f61..2c297834d268 100644
> --- a/net/rose/af_rose.c
> +++ b/net/rose/af_rose.c
> @@ -1410,7 +1410,7 @@ static int rose_info_show(struct seq_file *seq, void *v)
>  			   ax2asc(buf, &rose->dest_call));
> 
>  		if (ax25cmp(&rose->source_call, &null_ax25_address) == 0)
> -			callsign = "??????-?";
> +			callsign = "????\?\?-?";

I think I'd just split the string, eg: "?????" "-?".

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Andrew Lunn Oct. 29, 2020, 2:31 p.m. UTC | #2
On Thu, Oct 29, 2020 at 02:19:27PM +0000, David Laight wrote:
> From: Andrew Lunn
> > Sent: 28 October 2020 00:23
> > 
> > net/rose/af_rose.c: In function ‘rose_info_show’:
> > net/rose/af_rose.c:1413:20: warning: trigraph ??- ignored, use -trigraphs to enable [-Wtrigraphs]
> >  1413 |    callsign = "??????-?";
> > 
> > ??- is a trigraph, and should be replaced by a ˜ by the
> > compiler. However, trigraphs are being ignored in the build. Fix the
> > warning by escaping the ?? prefix of a trigraph.
> > 
> > Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> > ---
> >  net/rose/af_rose.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
> > index cf7d974e0f61..2c297834d268 100644
> > --- a/net/rose/af_rose.c
> > +++ b/net/rose/af_rose.c
> > @@ -1410,7 +1410,7 @@ static int rose_info_show(struct seq_file *seq, void *v)
> >  			   ax2asc(buf, &rose->dest_call));
> > 
> >  		if (ax25cmp(&rose->source_call, &null_ax25_address) == 0)
> > -			callsign = "??????-?";
> > +			callsign = "????\?\?-?";
> 
> I think I'd just split the string, eg: "?????" "-?".

Humm. I think we need a language lawyer.

Does it concatenate the strings and then evaluate for trigraphs? Or
does it evaluate for trigraphs, and then concatenate the strings?

     Andrew
David Laight Oct. 29, 2020, 2:52 p.m. UTC | #3
From: Andrew Lunn
> Sent: 29 October 2020 14:31
> On Thu, Oct 29, 2020 at 02:19:27PM +0000, David Laight wrote:
> > From: Andrew Lunn
> > > Sent: 28 October 2020 00:23
> > >
> > > net/rose/af_rose.c: In function ‘rose_info_show’:
> > > net/rose/af_rose.c:1413:20: warning: trigraph ??- ignored, use -trigraphs to enable [-Wtrigraphs]
> > >  1413 |    callsign = "??????-?";
> > >
> > > ??- is a trigraph, and should be replaced by a ˜ by the
> > > compiler. However, trigraphs are being ignored in the build. Fix the
> > > warning by escaping the ?? prefix of a trigraph.
> > >
> > > Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> > > ---
> > >  net/rose/af_rose.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
> > > index cf7d974e0f61..2c297834d268 100644
> > > --- a/net/rose/af_rose.c
> > > +++ b/net/rose/af_rose.c
> > > @@ -1410,7 +1410,7 @@ static int rose_info_show(struct seq_file *seq, void *v)
> > >  			   ax2asc(buf, &rose->dest_call));
> > >
> > >  		if (ax25cmp(&rose->source_call, &null_ax25_address) == 0)
> > > -			callsign = "??????-?";
> > > +			callsign = "????\?\?-?";
> >
> > I think I'd just split the string, eg: "?????" "-?".
> 
> Humm. I think we need a language lawyer.
> 
> Does it concatenate the strings and then evaluate for trigraphs? Or
> does it evaluate for trigraphs, and then concatenate the strings?

I'm 99.9999% sure trigraphs are evaluated before string concatenation.

Although trigraphs are such a stupid idea I'd be tempted to just
turn the warning off.
There is good reason why they are ignored by default.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Andrew Lunn Oct. 29, 2020, 3:13 p.m. UTC | #4
On Thu, Oct 29, 2020 at 02:52:52PM +0000, David Laight wrote:
> From: Andrew Lunn
> > Sent: 29 October 2020 14:31
> > On Thu, Oct 29, 2020 at 02:19:27PM +0000, David Laight wrote:
> > > From: Andrew Lunn
> > > > Sent: 28 October 2020 00:23
> > > >
> > > > net/rose/af_rose.c: In function ‘rose_info_show’:
> > > > net/rose/af_rose.c:1413:20: warning: trigraph ??- ignored, use -trigraphs to enable [-Wtrigraphs]
> > > >  1413 |    callsign = "??????-?";
> > > >
> > > > ??- is a trigraph, and should be replaced by a ˜ by the
> > > > compiler. However, trigraphs are being ignored in the build. Fix the
> > > > warning by escaping the ?? prefix of a trigraph.
> > > >
> > > > Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> > > > ---
> > > >  net/rose/af_rose.c | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
> > > > index cf7d974e0f61..2c297834d268 100644
> > > > --- a/net/rose/af_rose.c
> > > > +++ b/net/rose/af_rose.c
> > > > @@ -1410,7 +1410,7 @@ static int rose_info_show(struct seq_file *seq, void *v)
> > > >  			   ax2asc(buf, &rose->dest_call));
> > > >
> > > >  		if (ax25cmp(&rose->source_call, &null_ax25_address) == 0)
> > > > -			callsign = "??????-?";
> > > > +			callsign = "????\?\?-?";
> > >
> > > I think I'd just split the string, eg: "?????" "-?".
> > 
> > Humm. I think we need a language lawyer.
> > 
> > Does it concatenate the strings and then evaluate for trigraphs? Or
> > does it evaluate for trigraphs, and then concatenate the strings?
> 
> I'm 99.9999% sure trigraphs are evaluated before string concatenation.
> 
> Although trigraphs are such a stupid idea I'd be tempted to just
> turn the warning off.
> There is good reason why they are ignored by default.

Hi Arnd

I think this trigraph issues popped up because of one of the changes
you have in your playground, adding more warnings.

What do you think of disabling the trigraph warning as well as
disabling trigraphs themselves?

	   Andrew
Arnd Bergmann Oct. 29, 2020, 3:29 p.m. UTC | #5
On Thu, Oct 29, 2020 at 4:13 PM Andrew Lunn <andrew@lunn.ch> wrote:
> On Thu, Oct 29, 2020 at 02:52:52PM +0000, David Laight wrote:
> > From: Andrew Lunn
> > > Sent: 29 October 2020 14:31
>
> I think this trigraph issues popped up because of one of the changes
> you have in your playground, adding more warnings.
>
> What do you think of disabling the trigraph warning as well as
> disabling trigraphs themselves?

The trigraph warnings are currently disabled in mainline, and trigraphs
themselves are disabled in GCC unless explicitly enabled.

My series contained a patch that changes all trigraphs by adding
'\' characters, to let us no longer disable the warning and slightly
simplify the command line:

 drivers/atm/idt77252.c                                  | 2 +-
 drivers/gpu/drm/msm/msm_rd.c                            | 2 +-
 drivers/mtd/maps/sun_uflash.c                           | 2 +-
 drivers/net/ethernet/marvell/mvneta.c                   | 2 +-
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 +-
 drivers/s390/block/dasd_proc.c                          | 2 +-
 drivers/scsi/imm.c                                      | 4 ++--
 drivers/scsi/ppa.c                                      | 4 ++--
 drivers/tty/serial/sunsu.c                              | 2 +-
 net/rose/af_rose.c                                      | 4 ++--
 sound/isa/msnd/msnd.c                                   | 2 +-

Sorry you ran into this after you picked up the patches to the
Makefile but not my preparation patch.

I was unsure about whether this is worth changing, so I did not
send that one patch from my series and we can probably just
not drop the -Wno-trigraphs flag.

       Arnd
diff mbox series

Patch

diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index cf7d974e0f61..2c297834d268 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -1410,7 +1410,7 @@  static int rose_info_show(struct seq_file *seq, void *v)
 			   ax2asc(buf, &rose->dest_call));
 
 		if (ax25cmp(&rose->source_call, &null_ax25_address) == 0)
-			callsign = "??????-?";
+			callsign = "????\?\?-?";
 		else
 			callsign = ax2asc(buf, &rose->source_call);