]> git.dujemihanovic.xyz Git - linux.git/commit
xdrgen: Prevent reordering of encoder and decoder functions
authorChuck Lever <chuck.lever@oracle.com>
Fri, 13 Sep 2024 17:50:56 +0000 (13:50 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Fri, 20 Sep 2024 23:31:41 +0000 (19:31 -0400)
commit509abfc7a0ba66afa648e8216306acdc55ec54ed
tree496f544101fe68e1db1e91b2be0a0503990f5f36
parentfed8a17c61ffa2ba53dc749068b6f07ecf40e3bf
xdrgen: Prevent reordering of encoder and decoder functions

I noticed that "xdrgen source" reorders the procedure encoder and
decoder functions every time it is run. I would prefer that the
generated code be more deterministic: it enables a reader to better
see exactly what has changed between runs of the tool.

The problem is that Python sets are not ordered. I use a Python set
to ensure that, when multiple procedures use a particular argument or
result type, the encoder/decoder for that type is emitted only once.

Sets aren't ordered, but I can use Python dictionaries for this
purpose to ensure the procedure functions are always emitted in the
same order if the .x file does not change.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
tools/net/sunrpc/xdrgen/generators/program.py