Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

xdrgen: improve error reporting for invalid void declarations

RFC 4506 defines void as a zero-length type that may appear only as
union arms or as program argument/result types. It cannot be declared
with an identifier, so constructs like "typedef void temp;" are not
valid XDR.

Previously, xdrgen raised a NotImplementedError when it encountered a
void declaration in a typedef. Which was misleading, as the problem is an
invalid RPC specification rather than missing functionality in xdrgen.

This patch replaces the NotImplementedError for _XdrVoid in typedef
handling with a clearer ValueError that specifies incorrect use of void
in the XDR input, making it clear that the issue lies in the RPC
specification being parsed.

Signed-off-by: Khushal Chitturi <kc9282016@gmail.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

authored by

Khushal Chitturi and committed by
Chuck Lever
87a6e3b6 1f1fe81a

+4 -4
+4 -4
tools/net/sunrpc/xdrgen/generators/typedef.py
··· 58 58 elif isinstance(node, _XdrOptionalData): 59 59 raise NotImplementedError("<optional_data> typedef not yet implemented") 60 60 elif isinstance(node, _XdrVoid): 61 - raise NotImplementedError("<void> typedef not yet implemented") 61 + raise ValueError("invalid void usage in RPC Specification") 62 62 else: 63 63 raise NotImplementedError("typedef: type not recognized") 64 64 ··· 104 104 elif isinstance(node, _XdrOptionalData): 105 105 raise NotImplementedError("<optional_data> typedef not yet implemented") 106 106 elif isinstance(node, _XdrVoid): 107 - raise NotImplementedError("<void> typedef not yet implemented") 107 + raise ValueError("invalid void usage in RPC Specification") 108 108 else: 109 109 raise NotImplementedError("typedef: type not recognized") 110 110 ··· 165 165 elif isinstance(node, _XdrOptionalData): 166 166 raise NotImplementedError("<optional_data> typedef not yet implemented") 167 167 elif isinstance(node, _XdrVoid): 168 - raise NotImplementedError("<void> typedef not yet implemented") 168 + raise ValueError("invalid void usage in RPC Specification") 169 169 else: 170 170 raise NotImplementedError("typedef: type not recognized") 171 171 ··· 225 225 elif isinstance(node, _XdrOptionalData): 226 226 raise NotImplementedError("<optional_data> typedef not yet implemented") 227 227 elif isinstance(node, _XdrVoid): 228 - raise NotImplementedError("<void> typedef not yet implemented") 228 + raise ValueError("invalid void usage in RPC Specification") 229 229 else: 230 230 raise NotImplementedError("typedef: type not recognized") 231 231