Re: Argp Example #2 error

Eric Blake <[email protected]> Wed, 15 Oct 2014 09:09:24 -0600
Newsgroups gmane.comp.gnu.utils.bugs
Organization Red Hat, Inc.
Message-ID <[email protected]>
On 10/15/2014 07:35 AM, Rick Stanley wrote:
> In your example program:
> 
> https://www.gnu.org/software/libc/manual/html_node/Argp-Example-2.html#Argp-Example-2 
> 
> On line 37 of the code, there is a typo in the number of arguments:
> 
> static struct argp argp = { 0, 0, 0, doc };
> 
> Should be:
> 
> static struct argp argp = { 0, 0, 0, doc, 0, 0, 0 };

The two are strictly equivalent.  The C standard requires that all
trailing members of a struct are zero-initialized if omitted.

> 
> Compiling with:
> 
> gcc -Wall -Wextra -o argp argp.c
> 
> gives the following error:
> 
> missing initializer for field 'children' (or ‘help_filter’, or ‘argp_domain’) missing initializer for field
> 
> Until all three args have been added to the call.

What an annoying compiler warning option.  So even though it doesn't
affect code correctness, it does seem simple enough to do to shut up
overly-pedantic compilers.

However, you are more likely to get results by writing to the owner of
the libc manual
(https://www.gnu.org/software/libc/manual/html_node/Reporting-Bugs.html#Reporting-Bugs
suggests that they prefer bugzilla reports over mails to an unrelated
list, even for documentation bugs).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc (application/pgp-signature, 539 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg

iQEcBAEBCAAGBQJUPo4kAAoJEKeha0olJ0NqWUIH/3Gc1ITVzwBe98J7XG0F8d0Y
EQNuotKnEMYL851iV5vWzELXRG8IhnZPohG3M3N/plS3E2PeKyAZrKdHuFh0f8qX
ENjedQCwBSdOnJJr+F/WegeV0ND+Ttln/K7qgUgYJ8yaTkHK/kpgYD+sZ6NCHYRd
/9yCBEVKcaBjh+CiaXbMeHXVkWRbIN10Avt/ay2uO2y1aVUYRw5urdBxMm0GXoXN
MDlfU031++KHAlvSP3bhczQQmomlzjyuukoTjeMU5Yrh1Q927NugjGGrDDX1ybLE
7vhHWurc604KS25bpSVRfiD1Iy+tR/LMWUHdtAW0wYb9qGvOxOa3lkK8Wd1p8SA=
=PfVS
-----END PGP SIGNATURE-----