mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-23 07:23:12 +02:00
xdrgen: Rename "enum yada" types as just "yada"
This simplifies the generated C code and makes way for supporting big-endian XDR enums. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
parent
c060f8168b
commit
6e853dcd2d
|
@ -1,4 +1,4 @@
|
||||||
{# SPDX-License-Identifier: GPL-2.0 #}
|
{# SPDX-License-Identifier: GPL-2.0 #}
|
||||||
|
|
||||||
bool xdrgen_decode_{{ name }}(struct xdr_stream *xdr, enum {{ name }} *ptr);
|
bool xdrgen_decode_{{ name }}(struct xdr_stream *xdr, {{ name }} *ptr);
|
||||||
bool xdrgen_encode_{{ name }}(struct xdr_stream *xdr, enum {{ name }} value);
|
bool xdrgen_encode_{{ name }}(struct xdr_stream *xdr, {{ name }} value);
|
||||||
|
|
|
@ -8,7 +8,7 @@ bool
|
||||||
{% else %}
|
{% else %}
|
||||||
static bool __maybe_unused
|
static bool __maybe_unused
|
||||||
{% endif %}
|
{% endif %}
|
||||||
xdrgen_decode_{{ name }}(struct xdr_stream *xdr, enum {{ name }} *ptr)
|
xdrgen_decode_{{ name }}(struct xdr_stream *xdr, {{ name }} *ptr)
|
||||||
{
|
{
|
||||||
u32 val;
|
u32 val;
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
{# SPDX-License-Identifier: GPL-2.0 #}
|
{# SPDX-License-Identifier: GPL-2.0 #}
|
||||||
};
|
};
|
||||||
|
typedef enum {{ name }} {{ name }};
|
||||||
|
|
|
@ -8,7 +8,7 @@ bool
|
||||||
{% else %}
|
{% else %}
|
||||||
static bool __maybe_unused
|
static bool __maybe_unused
|
||||||
{% endif %}
|
{% endif %}
|
||||||
xdrgen_encode_{{ name }}(struct xdr_stream *xdr, enum {{ name }} value)
|
xdrgen_encode_{{ name }}(struct xdr_stream *xdr, {{ name }} value)
|
||||||
{
|
{
|
||||||
return xdr_stream_encode_u32(xdr, value) == XDR_UNIT;
|
return xdr_stream_encode_u32(xdr, value) == XDR_UNIT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ this_module = sys.modules[__name__]
|
||||||
excluded_apis = []
|
excluded_apis = []
|
||||||
header_name = "none"
|
header_name = "none"
|
||||||
public_apis = []
|
public_apis = []
|
||||||
enums = set()
|
|
||||||
structs = set()
|
structs = set()
|
||||||
pass_by_reference = set()
|
pass_by_reference = set()
|
||||||
|
|
||||||
|
@ -294,8 +293,6 @@ class ParseToAst(Transformer):
|
||||||
c_classifier = ""
|
c_classifier = ""
|
||||||
if isinstance(children[0], _XdrIdentifier):
|
if isinstance(children[0], _XdrIdentifier):
|
||||||
name = children[0].symbol
|
name = children[0].symbol
|
||||||
if name in enums:
|
|
||||||
c_classifier = "enum "
|
|
||||||
if name in structs:
|
if name in structs:
|
||||||
c_classifier = "struct "
|
c_classifier = "struct "
|
||||||
return _XdrDefinedType(
|
return _XdrDefinedType(
|
||||||
|
@ -320,7 +317,6 @@ class ParseToAst(Transformer):
|
||||||
def enum(self, children):
|
def enum(self, children):
|
||||||
"""Instantiate one _XdrEnum object"""
|
"""Instantiate one _XdrEnum object"""
|
||||||
enum_name = children[0].symbol
|
enum_name = children[0].symbol
|
||||||
enums.add(enum_name)
|
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
enumerators = []
|
enumerators = []
|
||||||
|
|
Loading…
Reference in New Issue
Block a user