On Thu, Apr 4, 2013 at 6:49 PM, Ted Unangst <t...@tedunangst.com> wrote:
> To prevent the future recurrence of some rather serious libc build
> bugs, such as a macro like strong_alias suddenly turning into an
> implicit function prototype, I think we should add some warnings and
> use as much -Werror as possible. (I'm not entirely sure this would
> have caught the missing strong_alias macro, but it seems like a good
> idea anyway.)
>
> This adds a (very) few warnings and fixes some of the fallout. The
> diff is a bit of a mix of things, since I initially tried -Wall before
> I ran away screaming. Over time, maybe some brave pioneers can expand
> the frontier.
...
> +CFLAGS+=-Wimplicit -Wparentheses -Wbounded -Werror

The make release process builds parts of libc with extra #defines to
disable stuff; have you done that with these flags to verify there
aren't warnings in those chunks?


> --- regex/regcomp.c     7 Nov 2011 09:58:27 -0000       1.21
> +++ regex/regcomp.c     5 Apr 2013 01:22:39 -0000
> @@ -171,8 +171,7 @@ regcomp(regex_t *preg, const char *patte
>                 len = strlen((char *)pattern);
>
>         /* do the mallocs early so failure handling is easy */
> -       g = (struct re_guts *)malloc(sizeof(struct re_guts) +
> -                                                       (NC-1)*sizeof(cat_t));
> +       g = (struct re_guts *)malloc(sizeof(struct re_guts));
...
> --- regex/regex2.h      30 Nov 2004 17:04:23 -0000      1.7
> +++ regex/regex2.h      5 Apr 2013 01:22:39 -0000
> @@ -149,7 +149,7 @@ struct re_guts {
>         int backrefs;           /* does it use back references? */
>         sopno nplus;            /* how deep does it nest +s? */
>         /* catspace must be last */
> -       cat_t catspace[1];      /* actually [NC] */
> +       cat_t catspace[NC];     /* actually [NC] */
>  };

Please tell me that used to actually _use_ the struct hack and didn't
always allocate the full size!



> --- regex/regexec.c     5 Aug 2005 13:03:00 -0000       1.11
> +++ regex/regexec.c     5 Apr 2013 01:22:39 -0000
> @@ -140,6 +140,8 @@ regexec(const regex_t *preg, const char
>      regmatch_t pmatch[], int eflags)
>  {
>         struct re_guts *g = preg->re_g;
> +       char *s = (char *)string; /* XXX fucking gcc XXX */

What's the real problem?  gcc loses the cast when it inlines smatcher/lmatcher?


> --- rpc/xdr_rec.c       1 Sep 2010 14:43:34 -0000       1.15
> +++ rpc/xdr_rec.c       5 Apr 2013 01:22:39 -0000
> @@ -409,6 +409,7 @@ xdrrec_destroy(XDR *xdrs)
>         mem_free(rstrm, sizeof(RECSTREAM));
>  }
>
> +bool_t __xdrrec_getrec(XDR *xdrs, enum xprt_stat *statp, bool_t expectdata);

It can't be made static?  I see no other references in base; check
xenocara and ask sthen@ to run a grep of the ports source...


> --- stdio/fputws.c      9 Nov 2009 00:18:27 -0000       1.5
> +++ stdio/fputws.c      5 Apr 2013 01:22:39 -0000
> @@ -35,6 +35,8 @@
>  #include <wchar.h>
>  #include "local.h"
>
> +wint_t __fputwc_unlock(wchar_t wc, FILE *fp);

Why not add that to stdio/local.h?


Philip Guenther

Reply via email to