symtable: Detect duplicate symbols in the same package

* src/symtable.xsl (symtable:find-duplicates):
  Update description.  Find duplicates in same package.
* test/symtable.xspec: Update test case accordingly.
master
Mike Gerwitz 2018-03-27 12:05:59 -04:00
parent d284d75f39
commit 852c42e340
2 changed files with 18 additions and 4 deletions

View File

@ -63,6 +63,8 @@
@emph{unless} another duplicate symbol of the @emph{unless} another duplicate symbol of the
same@tie{}@code{@@name} is found with a different @code{@@src}, same@tie{}@code{@@name} is found with a different @code{@@src},
in which case all symbols will be returned. in which case all symbols will be returned.
An exception to this rule is made when both symbols lack a @code{@@src},
meaning that they are both defined in the same package.
This allows sloppy comparison on concatenated symbol tables before This allows sloppy comparison on concatenated symbol tables before
tidying it up. tidying it up.
@ -94,7 +96,11 @@
<sequence select="if ( count( $srcs ) gt 1 ) then <sequence select="if ( count( $srcs ) gt 1 ) then
current-group() current-group()
else else
()" /> if ( ( $srcs[ 1 ] = '.' )
and ( count( current-group() ) gt 1 ) ) then
current-group()
else
()" />
</for-each-group> </for-each-group>
</function> </function>

View File

@ -74,12 +74,20 @@
symbol --> symbol -->
<preproc:sym name="no-src" /> <preproc:sym name="no-src" />
<!-- same package, no @src --> <!-- same package, no @src, no duplicate -->
<preproc:sym name="no-src-local" <preproc:sym name="no-src-local-a"
foo:uniq="a" /> foo:uniq="a" />
<preproc:sym name="no-src-local" <preproc:sym name="no-src-local-b"
foo:uniq="b" /> foo:uniq="b" />
<!-- same package, no @src, duplicate -->
<preproc:sym name="no-src-local"
foo:uniq="a"
foo:dup="true" />
<preproc:sym name="no-src-local"
foo:uniq="b"
foo:dup="true" />
<!-- so it should be considered in determining a duplicate --> <!-- so it should be considered in determining a duplicate -->
<preproc:sym name="no-src-dup" <preproc:sym name="no-src-dup"
foo:uniq="a" foo:uniq="a"