aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJaap Keuter <jaap.keuter@xs4all.nl>2020-05-05 21:13:07 +0200
committerAnders Broman <a.broman58@gmail.com>2020-05-05 20:12:29 +0000
commit5e4379f5b5fbf40151d58e6aab28b072e39fde17 (patch)
treefcf8b4ea3c4fceb745e8c066ef029d3f2bae0418 /tools
parentddc5a49ca471b2740917337ae2ef749868e097ac (diff)
IDL: make code generation reproducible
The current state of generated code from the IDL specification is not reproducible with the current omniidl backend. This change brings the backend in line with the currently committed generated source code. The exception to this is that the exceptions (no pun intended) were collected in a dictionary of unspecified ordering, therefore inherently non-reproducible. These thus differ from the previously committed source code (packet-parlay.c), but do contain the same lines. Also this rolls back commit 443df9389661901e8347f33864e2cd7539dbda9f because the committed generated source files were not created with the backend with this change, nor do they fail to build, as claimed in that commit. Special thanks to Luke Mewburn for working on the dictionary problem. Change-Id: I7707746d263c7556eb06883c877f70f0e9b357c5 Reviewed-on: https://code.wireshark.org/review/37153 Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl> Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/wireshark_gen.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/tools/wireshark_gen.py b/tools/wireshark_gen.py
index f58470f1f6..fc8b35681e 100755
--- a/tools/wireshark_gen.py
+++ b/tools/wireshark_gen.py
@@ -54,6 +54,7 @@
from __future__ import print_function
+import collections
import tempfile
from omniidl import idlast, idltype, idlutil, output
@@ -1747,7 +1748,7 @@ class wireshark_gen_C:
to generate dissect_exception_XXX functions.
"""
- ex_hash = {} # holds a hash of unique exceptions.
+ ex_hash = collections.OrderedDict() # holds a hash of unique exceptions.
for op in oplist:
for ex in op.raises():
if ex not in ex_hash:
@@ -1945,7 +1946,7 @@ default:
expert_add_info_format(pinfo, item, &ei_@dissector_name@_unknown_giop_msg, "Unknown GIOP message %d", header->message_type);"""
template_helper_switch_msgtype_default_end = """\
-break;"""
+ break;"""
template_helper_switch_msgtype_end = """\
} /* switch(header->message_type) */"""
@@ -2566,27 +2567,27 @@ decode_@sname@_at(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U
# as omniidl accessor returns integer or Enum.
template_union_code_save_discriminant_enum = """\
-disc_s_@discname@ = (gint32) get_CDR_ulong(tvb,offset,stream_is_big_endian, boundary); /* save Enum Value discriminant and cast to gint32 */
+disc_s_@discname@ = (gint32) u_octet4; /* save Enum Value discriminant and cast to gint32 */
"""
template_union_code_save_discriminant_long = """\
-disc_s_@discname@ = (gint32) get_CDR_long(tvb,offset,stream_is_big_endian, boundary); /* save gint32 discriminant and cast to gint32 */
+disc_s_@discname@ = (gint32) s_octet4; /* save gint32 discriminant and cast to gint32 */
"""
template_union_code_save_discriminant_ulong = """\
-disc_s_@discname@ = (gint32) get_CDR_ulong(tvb,offset,stream_is_big_endian, boundary); /* save guint32 discriminant and cast to gint32 */
+disc_s_@discname@ = (gint32) u_octet4; /* save guint32 discriminant and cast to gint32 */
"""
template_union_code_save_discriminant_short = """\
-disc_s_@discname@ = (gint32) get_CDR_short(tvb,offset,stream_is_big_endian, boundary); /* save gint16 discriminant and cast to gint32 */
+disc_s_@discname@ = (gint32) s_octet2; /* save gint16 discriminant and cast to gint32 */
"""
template_union_code_save_discriminant_ushort = """\
-disc_s_@discname@ = (gint32) get_CDR_ushort(tvb,offset,stream_is_big_endian, boundary); /* save guint16 discriminant and cast to gint32 */
+disc_s_@discname@ = (gint32) u_octet2; /* save guint16 discriminant and cast to gint32 */
"""
template_union_code_save_discriminant_char = """\
-disc_s_@discname@ = (gint32) get_CDR_char(tvb,offset,stream_is_big_endian, boundary); /* save guint1 discriminant and cast to gint32 */
+disc_s_@discname@ = (gint32) u_octet1; /* save guint1 discriminant and cast to gint32 */
"""
template_union_code_save_discriminant_boolean = """\
-disc_s_@discname@ = (gint32) get_CDR_boolean(tvb,offset,stream_is_big_endian, boundary); /* save guint1 discriminant and cast to gint32 */
+disc_s_@discname@ = (gint32) u_octet1; /* save guint1 discriminant and cast to gint32 */
"""
template_comment_union_code_label_compare_start = """\
if (disc_s_@discname@ == @labelval@) {