<p>neels has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/18256">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">struct_endianess.py: also recognise unnamed substructs<br><br>Before this, the new dtap_header substruct construct would end up being split<br>up in a weird way:<br><br> struct dtap_header {<br> uint8_t type;<br> union {<br> uint8_t link_id; /* Backward compatibility */<br> struct {<br> uint8_t dlci_cc:2,<br> dlci_spare:3,<br> dlci_sapi:3; /* enum gsm0406_dlc_sapi */<br> };<br> };<br> uint8_t length;<br> } __attribute__((packed));<br><br>would previously become<br><br> struct dtap_header {<br> uint8_t type;<br> union {<br> uint8_t link_id; /* Backward compatibility */<br> struct {<br> #if OSMO_IS_LITTLE_ENDIAN<br> uint8_t dlci_cc:2,<br> dlci_spare:3,<br> dlci_sapi:3; /* enum gsm0406_dlc_sapi */<br> };<br> };<br> uint8_t length;<br> #elif OSMO_IS_BIG_ENDIAN<br> /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */<br> uint8_t dlci_sapi:3, dlci_spare:3, dlci_cc:2;<br> };<br> };<br> uint8_t length;<br> #endif<br> } __attribute__((packed));<br><br>now becomes<br><br> struct dtap_header {<br> uint8_t type;<br> union {<br> uint8_t link_id; /* Backward compatibility */<br> struct {<br> #if OSMO_IS_LITTLE_ENDIAN<br> uint8_t dlci_cc:2,<br> dlci_spare:3,<br> dlci_sapi:3; /* enum gsm0406_dlc_sapi */<br> #elif OSMO_IS_BIG_ENDIAN<br> /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */<br> uint8_t dlci_sapi:3, dlci_spare:3, dlci_cc:2;<br> #endif<br> };<br> };<br> uint8_t length;<br> } __attribute__((packed));<br><br>Change-Id: I3c4986ebd1e41aad8b279d6132b7e3b2539d7dc5<br>---<br>M contrib/struct_endianess.py<br>1 file changed, 3 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/56/18256/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/contrib/struct_endianess.py b/contrib/struct_endianess.py</span><br><span>index be73fbe..6ce75fc 100755</span><br><span>--- a/contrib/struct_endianess.py</span><br><span>+++ b/contrib/struct_endianess.py</span><br><span>@@ -17,6 +17,7 @@</span><br><span> </span><br><span> re_substruct_start = re.compile(r'^\s+struct\s*{\s*$')</span><br><span> re_substruct_end = re.compile(r'^\s+}\s*([^;]*\s)[a-zA-Z_][a-zA-Z_0-9]*\s*;\s*$')</span><br><span style="color: hsl(120, 100%, 40%);">+re_unnamed_substruct_end = re.compile(r'^\s+}\s*;\s*$')</span><br><span> </span><br><span> re_int_def = re.compile(r'(^\s*((const|unsigned|signed|char|int|long|int[0-9]+_t|uint[0-9]_t)\s+)+\s*)([^;]*;)',</span><br><span> re.DOTALL | re.MULTILINE)</span><br><span>@@ -73,7 +74,8 @@</span><br><span> line = struct_body_lines[j]</span><br><span> </span><br><span> if (re_substruct_start.fullmatch(line)</span><br><span style="color: hsl(0, 100%, 40%);">- or re_substruct_end.fullmatch(line)):</span><br><span style="color: hsl(120, 100%, 40%);">+ or re_substruct_end.fullmatch(line)</span><br><span style="color: hsl(120, 100%, 40%);">+ or re_unnamed_substruct_end.fullmatch(line)):</span><br><span> end_def()</span><br><span> arbitrary_part.append(line)</span><br><span> j += 1</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmocore/+/18256">change 18256</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/libosmocore/+/18256"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I3c4986ebd1e41aad8b279d6132b7e3b2539d7dc5 </div>
<div style="display:none"> Gerrit-Change-Number: 18256 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>