Greetings.

On Mon, 28 Apr 2014 18:05:54 +0200 "Roberto E. Vargas Caballero" 
<k...@shike2.com> wrote:
> >> The problem is Wall change from one system to another (this is something 
> >> OpenBSD users know with strcpy calls...), and it doesn't force how to 
> >> remove the warning, so at the end I think style is not really improved 
> >> with Wall (and guys, some of the warning are really, really stupid). 
> 
> > There is no solution to this but to either fix the platforms or the com‐ 
> > piler. St does not have to adapt. 
> 
> I agree with you, but I think is we want to follow a style, we have to
> write a style guide, and not follow the Wall of the compiler, that
> can change, and that generate a lot of incorrect warnings. For example,
> after my last patch, compiling in linux you do not get any warning,
> but if you compile in OpenBSD you get this output:
> 
> In file included from /usr/X11R6/include/X11/Xlib.h:47,
>                  from st.c:25:
> /usr/X11R6/include/X11/Xfuncproto.h:144:24: warning: ISO C does not permit 
> named variadic macros
> st.c: In function 'techo':
> st.c:2303: warning: comparison is always false due to limited range of data 
> type
> st.c:2303: warning: comparison is always true due to limited range of data 
> type
> CC -o st
> /usr/X11R6/lib/libX11.so.16.0: warning: strcpy() is almost always misused, 
> please use strlcpy()
> /usr/X11R6/lib/libX11.so.16.0: warning: strcat() is almost always misused, 
> please use strlcat()
> /usr/X11R6/lib/libX11.so.16.0: warning: sprintf() is often misused, please 
> use snprintf()
> 
> What I should do here? Fix these warnings that are not shown in linux?, and
> if I don't fix them, how do I know that a warning if generated only in
> OpenBSD and it is not generated in Linux?, I have to compile in all
> the possible systems and fix all the warning that every compiler
> give me?. If we want to follow warning as a style guide we should
> explititly put what warnings we want to honour and not rely in
> Wall.

That’s  too  vague.  We  don’t live in 1990 anymore, where people didn’t
have POSIX around. The tips given by OpenBSD are useful  and  should  be
fixed.   That’s  why  they  are  warnings. Of course st is not responsi‐
ble to fix problems with X11 headers.

People  still  need  to  report warnings, if they should be fixed. St is
written for its authors. Users have to be programmers. If  we  lose  the
fun and this gets too corporate the chance of introducing bloat gets too
high.

St is a small project. Every warning can be discussed. I don’t use Open‐
BSD, so I won’t fix these warnings, if they are not reported.

Btw.,  the  bloat addition to st is increasing. Do we really need all of
those features to reach the original goal to handle terminal  emulation?
Alternative  charsets?  Why?  I  know you need much of that crap to have
compatibility to old machines you are using. Why don’t  you  throw  them
away?

> Another problem related to the style is you only can know what style is
> used guessing it from the source, but in the source you can find
> some things like:
> 
>         if(term.c.x+width < term.col) {
>                 tmoveto(term.c.x+width, term.c.y);
>         } else {
>                 term.c.state |= CURSOR_WRAPNEXT;
>         }
> 
> but you also can find:
> 
>       if(xwrite(cmdfd, s, n) == -1)
>                 die("write error on tty: %s\n", strerror(errno));
> 
> So, is it mandatory parenthesis in one line if? I don't know it.

It’s mandatory if you have else.


Sincerely,

Christoph Lohmann


Reply via email to