Andrew Deason abbadd3f4b rxgen: Properly generate brief union default arm
Commit 13ae3de3 (Add "brief" option to rxgen) added the -b option to
rxgen, which (among other things) makes rxgen stop including the name
of an RPC-L union type within its fields. That is, instead of this:

    struct foo_type {
        afs_int32 foo_tag;
        union {
            /* ... */
        } foo_type_u;
    };

rxgen -b generates this:

    struct foo_type {
        afs_int32 foo_tag;
        union {
            /* ... */
        } u;
    };

And all of the autogenerated XDR code is altered to use the 'u' field
instead of foo_type_u. However, if a 'default:' arm is defined in the
definition for the RPC-L union, the autogenerated XDR code still tries
to reference the non-brief name (e.g. foo_type_u). This causes a build
failure when actually trying to compile the generated .xdr.c, like so:

    foo.xdr.c:809:39: error: 'foo_type' has no member named 'foo_type_u'
        if (!xdr_bytes(xdrs, (char **)&objp->foo_type_u.xxx, &__len, FOO_MAX)) {
                                           ^
    foo.xdr.c:812:11: error: 'foo_type' has no member named 'foo_type_u'
        *(&objp->foo_type_u.xxx) = __len;

This happens because the portion of emit_union() that generates the
XDR code for the default arm wasn't updated to use a different
formatting string when 'brief_flag' is set, like the rest of
emit_union.

To fix this, just check for brief_flag and use 'briefformat'
accordingly, like the other code that checks for brief_flag.

Currently nothing in the tree uses the default arm of RPC-L unions
with 'rxgen -b', but external callers could, or our future code may do
so.

Change-Id: Ifcebfc48a3a64c68fee12ba0d177ae19b0956c58
Reviewed-on: https://gerrit.openafs.org/14107
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2020-03-27 11:05:35 -04:00
2018-02-04 15:34:55 -05:00
2016-09-25 21:05:23 -04:00
2020-01-10 16:10:57 -05:00
2017-08-05 18:47:04 -04:00
2015-12-28 19:32:17 -05:00

AFS is a distributed file system that enables users to share and
access all of the files stored in a network of computers as easily as
they access the files stored on their local machines. The file system is
called distributed for this exact reason: files can reside on many
different machines, but are available to users on every machine.

OpenAFS 1.0 was originally released by IBM under the terms of the
IBM Public License 1.0 (IPL10).  For details on IPL10 see the LICENSE
file in this directory.  The current OpenAFS distribution is licensed
under a combination of the IPL10 and many other licenses as granted by
the relevant copyright holders.  The LICENSE file in this directory
contains more details, thought it is not a comprehensive statement.

See INSTALL for information about building and installing OpenAFS
on various platforms.

See CODING for developer information and guidelines.

See NEWS for recent changes to OpenAFS.

Description
No description provided
Readme Multiple Licenses 164 MiB
Languages
C 72.2%
C++ 20.1%
Makefile 1.4%
Perl 1.2%
Rich Text Format 1%
Other 3.7%