This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Neels Hofmeyr gerrit-no-reply at lists.osmocom.orgNeels Hofmeyr has submitted this change and it was merged. Change subject: contrib/fsm-to-dot: warn about identically named FSMs ...................................................................... contrib/fsm-to-dot: warn about identically named FSMs FSMs with identical names confuse the script, so at least warn about them. IMHO we should also have different names for each FSM, so not bothering to make the script safe against identical naming. Change-Id: I4fe7e85d2fdf23e2ba964f3b47be1954edc63cef --- M contrib/fsm-to-dot.py 1 file changed, 19 insertions(+), 2 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved; Verified diff --git a/contrib/fsm-to-dot.py b/contrib/fsm-to-dot.py index 96f7e00..85e2806 100755 --- a/contrib/fsm-to-dot.py +++ b/contrib/fsm-to-dot.py @@ -262,7 +262,7 @@ def __str__(fsm): return 'Fsm(%r,%r)' % (fsm.struct_name, fsm.from_file) - def parse_states(fsm, src): + def parse_states(fsm, src, c_file): state = None started = None @@ -274,6 +274,15 @@ for line in lines: state_name = state_starts(line) if state_name: + state = fsm.find_state_by_name(state_name) + if state is not None: + if c_file is fsm.from_file: + print('ERROR: fsm %r has multiple definitions of state %r' % (fsm, state_name)) + else: + print('ERROR: it appears two FSMs with identical name %r exist in %r and %r' + % (fsm.struct_name, fsm.from_file, c_file)) + state = None + continue state = State() fsm.states.append(state) started = None @@ -664,7 +673,7 @@ states_struct_name = m.group(1) for fsm in fsms: if states_struct_name == fsm.states_struct_name: - fsm.parse_states(c_file.extract_block('{', '}', m.start())) + fsm.parse_states(c_file.extract_block('{', '}', m.start()), c_file) def parse_functions(c_file): funcs = {} @@ -787,6 +796,14 @@ for c_file in c_files: fsms.extend(c_file.find_fsms()) +for fsm1 in fsms: + for fsm2 in fsms: + if fsm1 is fsm2: + continue + if fsm1.states_struct_name == fsm2.states_struct_name: + print('ERROR: two distinct FSMs share the same states-struct name: %r and %r both use %r' + % (fsm1, fsm2, fsm1.states_struct_name)) + for c_file in c_files: c_file.find_fsm_states(fsms) c_file.find_event_sources(fsms) -- To view, visit https://gerrit.osmocom.org/7506 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4fe7e85d2fdf23e2ba964f3b47be1954edc63cef Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de> Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>