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 New
Headers show
Series net trigraph fixes for W=1 | expand

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
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);