linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Paul Eggert <eggert-764C0pRuGfqVc3sceRu5cw@public.gmane.org>,
	"Michael Kerrisk (man-pages)"
	<mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Siddhesh Poyarekar
	<siddhesh-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Rich Felker <dalias-/miJ2pyFWUyWIDz0JBNUog@public.gmane.org>,
	Carlos O'Donell <carlos-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	KOSAKI Motohiro
	<kosaki.motohiro-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	libc-alpha <libc-alpha-9JcytcrH/bA+uJoB2kUjGw@public.gmane.org>,
	Roland McGrath <roland-/Z5OmTQCD9xF6kxbq+BtvQ@public.gmane.org>,
	linux-man <linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] Fix readdir_r with long file names
Date: Tue, 8 Mar 2016 13:20:07 +0100	[thread overview]
Message-ID: <56DEC377.9070204@redhat.com> (raw)
In-Reply-To: <56D72683.6010302-764C0pRuGfqVc3sceRu5cw@public.gmane.org>

On 03/02/2016 06:44 PM, Paul Eggert wrote:
> +/* Declare a structure member named ID, with type "array of TYPE", and
> +   with actual size unspecified but with nominal size SIZE for the
> +   benefit of traditional applications.  If the application is
> +   compiled with _FLEXARRAY_SOURCE and if the compiler is C99 or
> +   better, model this as a flexible array.  Otherwise, model it as a
> +   fixed-size array of size SIZE (followed by a flexible array
> +   afterwards, if C99, for the benefit of source-code analyzers that
> +   can use this as a cue that the array is really varying-size).  The
> +   fixed-size array is for compatibility with programs that unwisely
> +   take the size of structures that contain flexible arrays, and which
> +   rely on traditional glibc which uses fixed-size arrays.  */
> +#ifndef __flexarray
> +# ifdef __USE_FLEXARRAY
> +#  define __flexarray(id, type, size) type id[]
> +# else
> +#  define __flexarray(id, type, size) type id[size]; type __flexarray __flexarr
> +# endif
> +#endif

Sorry, I'm not convinced this is good compiler hint.  I suspect it moves
things in the opposite direction.  Some compilers likely have hacks to
support arrays of length 1 as flexible arrays if the array is at the end
of a struct, and after your change, the member is no longer at the end,
potentially disabling the flexible array kludge.

I think we should interact better with compilers in this area, but this
needs fairly explicit mark-up, showing what we need, and not something
that requires the compiler to guess.

Thanks,
Florian
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      parent reply	other threads:[~2016-03-08 12:20 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <51B0B39F.4060202@redhat.com>
     [not found] ` <51B0BD36.3030202@redhat.com>
     [not found]   ` <CAHGf_=r9Rz63pho+84ORk0a_oDyJSj-MCnZ56uPrT3L6sVEfeQ@mail.gmail.com>
     [not found]     ` <20130607013024.GO29800@brightrain.aerifal.cx>
     [not found]       ` <51B19203.3070307@redhat.com>
     [not found]         ` <20130607144143.GQ29800@brightrain.aerifal.cx>
     [not found]           ` <51B57E35.4080403@redhat.com>
     [not found]             ` <51B65EA7.2020402@redhat.com>
     [not found]               ` <20130611011324.GT29800@brightrain.aerifal.cx>
     [not found]                 ` <51B8702D.2060505@redhat.com>
     [not found]                   ` <20130813040038.GE21795@spoyarek.pnq.redhat.com>
     [not found]                     ` <520C88A6.9070501@redhat.com>
     [not found]                       ` <520C88A6.9070501-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-03-01  8:07                         ` [PATCH] Fix readdir_r with long file names Michael Kerrisk (man-pages)
2016-03-01 16:59                           ` Florian Weimer
     [not found]                             ` <56D5CA79.9030204-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-03-01 20:14                               ` Michael Kerrisk (man-pages)
     [not found]                                 ` <56D5F832.3070209-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-03-01 20:27                                   ` Florian Weimer
     [not found]                                     ` <56D5FB3D.5000306-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-03-01 21:01                                       ` Michael Kerrisk (man-pages)
     [not found]                                         ` <56D60335.7010906-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-03-01 22:21                                           ` Florian Weimer
     [not found]                                             ` <56D615D7.5020304-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-03-01 22:27                                               ` Rich Felker
2016-03-02  8:17                                               ` Michael Kerrisk (man-pages)
2016-03-01 21:20                                     ` Paul Eggert
     [not found]                                       ` <56D607BB.6080701-764C0pRuGfqVc3sceRu5cw@public.gmane.org>
2016-03-01 22:16                                         ` Florian Weimer
2016-03-01 22:41                                           ` Paul Eggert
     [not found]                                             ` <56D61A86.3050108-764C0pRuGfqVc3sceRu5cw@public.gmane.org>
2016-03-01 23:07                                               ` Florian Weimer
     [not found]                                                 ` <56D620AA.40108-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-03-01 23:25                                                   ` Paul Eggert
     [not found]                                                     ` <56D624FE.1090702-764C0pRuGfqVc3sceRu5cw@public.gmane.org>
2016-03-01 23:44                                                       ` Florian Weimer
     [not found]                                                         ` <56D6294A.5040703-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-03-02 10:39                                                           ` Michael Kerrisk (man-pages)
     [not found]                                                             ` <56D6C2CA.2020609-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-03-08 17:20                                                               ` Michael Kerrisk (man-pages)
2016-03-10 11:22                                                             ` Florian Weimer
     [not found]                                                               ` <56E158F4.6040506-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-03-10 17:06                                                                 ` Michael Kerrisk (man-pages)
2016-03-02 17:44                                                         ` Paul Eggert
     [not found]                                                           ` <56D72683.6010302-764C0pRuGfqVc3sceRu5cw@public.gmane.org>
2016-03-03 22:39                                                             ` Joseph Myers
2016-03-08 12:20                                                             ` Florian Weimer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56DEC377.9070204@redhat.com \
    --to=fweimer-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=carlos-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=dalias-/miJ2pyFWUyWIDz0JBNUog@public.gmane.org \
    --cc=eggert-764C0pRuGfqVc3sceRu5cw@public.gmane.org \
    --cc=kosaki.motohiro-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=libc-alpha-9JcytcrH/bA+uJoB2kUjGw@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=roland-/Z5OmTQCD9xF6kxbq+BtvQ@public.gmane.org \
    --cc=siddhesh-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).