Re: mg: fix problems found by gcc 10

2020-02-09 Thread Sebastian Benoit
read ok

Florian Obser(flor...@openbsd.org) on 2020.02.09 10:46:34 +0100:
> Anyone? I'll commit this soon if I don't hear back, I don't think this
> is contentious.
> 
> On Fri, Feb 07, 2020 at 03:59:50PM +0100, Florian Obser wrote:
> > Moving from misc to tech.
> > 
> > This is effectively Ulrich's diff from github with a bit of whitespace 
> > shuffling.
> > 
> > OK?
> > 
> > diff --git def.h def.h
> > index d4f00e84e59..0db023973e0 100644
> > --- def.h
> > +++ def.h
> > @@ -337,7 +337,7 @@ void ttnowindow(void);
> >  voidttcolor(int);
> >  voidttresize(void);
> >  
> > -volatile sig_atomic_t winch_flag;
> > +extern volatile sig_atomic_t winch_flag;
> >  
> >  /* ttyio.c */
> >  voidttopen(void);
> > @@ -752,11 +752,7 @@ extern char cinfo[];
> >  extern char*keystrings[];
> >  extern char pat[NPAT];
> >  extern char prompt[];
> > -
> > -/*
> > - * Globals.
> > - */
> > -int tceeol;
> > -int tcinsl;
> > -int tcdell;
> > -int rptcount;  /* successive invocation count */
> > +extern int  tceeol;
> > +extern int  tcinsl;
> > +extern int  tcdell;
> > +extern int  rptcount;  /* successive invocation count */
> > diff --git kbd.c kbd.c
> > index 06d6c9fcf48..5f9b0a9efa6 100644
> > --- kbd.c
> > +++ kbd.c
> > @@ -26,13 +26,13 @@ char prompt[PROMPTL] = "", *promptp = prompt;
> >  
> >  static int mgwrap(PF, int, int);
> >  
> > -static int  use_metakey = TRUE;
> > -static int  pushed = FALSE;
> > -static int  pushedc;
> > +static int  use_metakey = TRUE;
> > +static int  pushed = FALSE;
> > +static int  pushedc;
> >  
> >  struct map_element *ele;
> > -
> > -struct key key;
> > +struct key  key;
> > +int rptcount;
> >  
> >  /*
> >   * Toggle the value of use_metakey
> > diff --git tty.c tty.c
> > index 0b64c4b5453..c378cb240dd 100644
> > --- tty.c
> > +++ tty.c
> > @@ -45,6 +45,11 @@ static const char*scroll_fwd;/* How to 
> > scroll forward. */
> >  
> >  static void winchhandler(int);
> >  
> > +volatile sig_atomic_t   winch_flag;
> > +int tceeol;
> > +int tcinsl;
> > +int tcdell;
> > +
> >  /* ARGSUSED */
> >  static void
> >  winchhandler(int sig)
> > 
> > 
> > On Tue, Feb 04, 2020 at 12:51:46AM +0100, Han Boetes wrote:
> > > The latest version of gcc is more picky about global variables resulting 
> > > in
> > > this bug report for my portable version of mg:
> > >   https://github.com/hboetes/mg/issues/12
> > > 
> > > To which Ulrich M?ller created a pull request which fixed the problem:
> > >   https://github.com/hboetes/mg/pull/13/files
> > > 
> > > Is this worth applying to the upstream branch?
> > 
> > -- 
> > I'm not entirely sure you are real.
> > 
> 
> -- 
> I'm not entirely sure you are real.
> 



Re: mg: fix problems found by gcc 10

2020-02-09 Thread Florian Obser
Anyone? I'll commit this soon if I don't hear back, I don't think this
is contentious.

On Fri, Feb 07, 2020 at 03:59:50PM +0100, Florian Obser wrote:
> Moving from misc to tech.
> 
> This is effectively Ulrich's diff from github with a bit of whitespace 
> shuffling.
> 
> OK?
> 
> diff --git def.h def.h
> index d4f00e84e59..0db023973e0 100644
> --- def.h
> +++ def.h
> @@ -337,7 +337,7 @@ void   ttnowindow(void);
>  void  ttcolor(int);
>  void  ttresize(void);
>  
> -volatile sig_atomic_t winch_flag;
> +extern volatile sig_atomic_t winch_flag;
>  
>  /* ttyio.c */
>  void  ttopen(void);
> @@ -752,11 +752,7 @@ extern char   cinfo[];
>  extern char  *keystrings[];
>  extern char   pat[NPAT];
>  extern char   prompt[];
> -
> -/*
> - * Globals.
> - */
> -int   tceeol;
> -int   tcinsl;
> -int   tcdell;
> -int   rptcount;  /* successive invocation count */
> +extern inttceeol;
> +extern inttcinsl;
> +extern inttcdell;
> +extern intrptcount;  /* successive invocation count */
> diff --git kbd.c kbd.c
> index 06d6c9fcf48..5f9b0a9efa6 100644
> --- kbd.c
> +++ kbd.c
> @@ -26,13 +26,13 @@ char   prompt[PROMPTL] = "", *promptp = prompt;
>  
>  static int mgwrap(PF, int, int);
>  
> -static intuse_metakey = TRUE;
> -static intpushed = FALSE;
> -static intpushedc;
> +static intuse_metakey = TRUE;
> +static intpushed = FALSE;
> +static intpushedc;
>  
>  struct map_element   *ele;
> -
> -struct key key;
> +struct keykey;
> +int   rptcount;
>  
>  /*
>   * Toggle the value of use_metakey
> diff --git tty.c tty.c
> index 0b64c4b5453..c378cb240dd 100644
> --- tty.c
> +++ tty.c
> @@ -45,6 +45,11 @@ static const char  *scroll_fwd;/* How to scroll 
> forward. */
>  
>  static void   winchhandler(int);
>  
> +volatile sig_atomic_t winch_flag;
> +int   tceeol;
> +int   tcinsl;
> +int   tcdell;
> +
>  /* ARGSUSED */
>  static void
>  winchhandler(int sig)
> 
> 
> On Tue, Feb 04, 2020 at 12:51:46AM +0100, Han Boetes wrote:
> > The latest version of gcc is more picky about global variables resulting in
> > this bug report for my portable version of mg:
> >   https://github.com/hboetes/mg/issues/12
> > 
> > To which Ulrich Müller created a pull request which fixed the problem:
> >   https://github.com/hboetes/mg/pull/13/files
> > 
> > Is this worth applying to the upstream branch?
> 
> -- 
> I'm not entirely sure you are real.
> 

-- 
I'm not entirely sure you are real.



Re: mg: fix problems found by gcc 10

2020-02-07 Thread Florian Obser
Moving from misc to tech.

This is effectively Ulrich's diff from github with a bit of whitespace 
shuffling.

OK?

diff --git def.h def.h
index d4f00e84e59..0db023973e0 100644
--- def.h
+++ def.h
@@ -337,7 +337,7 @@ void ttnowindow(void);
 voidttcolor(int);
 voidttresize(void);
 
-volatile sig_atomic_t winch_flag;
+extern volatile sig_atomic_t winch_flag;
 
 /* ttyio.c */
 voidttopen(void);
@@ -752,11 +752,7 @@ extern char cinfo[];
 extern char*keystrings[];
 extern char pat[NPAT];
 extern char prompt[];
-
-/*
- * Globals.
- */
-int tceeol;
-int tcinsl;
-int tcdell;
-int rptcount;  /* successive invocation count */
+extern int  tceeol;
+extern int  tcinsl;
+extern int  tcdell;
+extern int  rptcount;  /* successive invocation count */
diff --git kbd.c kbd.c
index 06d6c9fcf48..5f9b0a9efa6 100644
--- kbd.c
+++ kbd.c
@@ -26,13 +26,13 @@ char prompt[PROMPTL] = "", *promptp = prompt;
 
 static int mgwrap(PF, int, int);
 
-static int  use_metakey = TRUE;
-static int  pushed = FALSE;
-static int  pushedc;
+static int  use_metakey = TRUE;
+static int  pushed = FALSE;
+static int  pushedc;
 
 struct map_element *ele;
-
-struct key key;
+struct key  key;
+int rptcount;
 
 /*
  * Toggle the value of use_metakey
diff --git tty.c tty.c
index 0b64c4b5453..c378cb240dd 100644
--- tty.c
+++ tty.c
@@ -45,6 +45,11 @@ static const char*scroll_fwd;/* How to scroll 
forward. */
 
 static void winchhandler(int);
 
+volatile sig_atomic_t   winch_flag;
+int tceeol;
+int tcinsl;
+int tcdell;
+
 /* ARGSUSED */
 static void
 winchhandler(int sig)


On Tue, Feb 04, 2020 at 12:51:46AM +0100, Han Boetes wrote:
> The latest version of gcc is more picky about global variables resulting in
> this bug report for my portable version of mg:
>   https://github.com/hboetes/mg/issues/12
> 
> To which Ulrich Müller created a pull request which fixed the problem:
>   https://github.com/hboetes/mg/pull/13/files
> 
> Is this worth applying to the upstream branch?

-- 
I'm not entirely sure you are real.