@@ -154,9 +154,31 @@ extUniqueCell(def, option)
154
154
}
155
155
if (lastreg != lp && lastreg != & processedLabel )
156
156
{
157
- nwarn += extMakeUnique (def , ll , lp , lregList ,
157
+ LabelList * lltest = NULL ;
158
+
159
+ /* If the last label is a port and this label is not, then
160
+ * run extMakeUnique on the port (since extMakeUnique() causes
161
+ * all other nodes to be made unique). This preserves the port
162
+ * name whenever a port name disagrees with an internal name.
163
+ */
164
+
165
+ if (!(ll -> ll_label -> lab_flags & PORT_DIR_MASK ))
166
+ for (lltest = lastreg -> lreg_labels ; lltest ; lltest = lltest -> ll_next )
167
+ if (!strcmp (lltest -> ll_label -> lab_text , text ))
168
+ if (lltest -> ll_label -> lab_flags & PORT_DIR_MASK )
169
+ break ;
170
+
171
+ if (lltest != NULL )
172
+ {
173
+ nwarn += extMakeUnique (def , lltest , lastreg , lregList ,
174
+ & labelHash , option );
175
+ }
176
+ else
177
+ {
178
+ nwarn += extMakeUnique (def , ll , lp , lregList ,
158
179
& labelHash , option );
159
- HashSetValue (he , (ClientData ) & processedLabel );
180
+ HashSetValue (he , (ClientData ) & processedLabel );
181
+ }
160
182
}
161
183
}
162
184
}
@@ -199,15 +221,15 @@ extMakeUnique(def, ll, lreg, lregList, labelHash, option)
199
221
if (option == EXT_UNIQ_ALL )
200
222
goto makeUnique ;
201
223
else if ((option == EXT_UNIQ_NOPORTS || option == EXT_UNIQ_NOTOPPORTS ) &&
202
- ! (ll -> ll_label -> lab_flags & PORT_DIR_MASK ))
224
+ (ll -> ll_label -> lab_flags & PORT_DIR_MASK ))
203
225
goto makeUnique ;
204
226
205
227
cpend = strchr (text , '\0' );
206
228
if (cpend > text ) cpend -- ;
207
229
if (* cpend == '#' ) goto makeUnique ;
208
230
if (* cpend == '!' ) return 0 ;
209
231
if (((option == EXT_UNIQ_NOPORTS ) || (option == EXT_UNIQ_NOTOPPORTS ))
210
- && (ll -> ll_label -> lab_flags & PORT_DIR_MASK ))
232
+ && ! (ll -> ll_label -> lab_flags & PORT_DIR_MASK ))
211
233
return 0 ;
212
234
213
235
/* Generate a warning for each occurrence of this label */
@@ -250,7 +272,7 @@ extMakeUnique(def, ll, lreg, lregList, labelHash, option)
250
272
{
251
273
if (ll2 -> ll_label == (Label * ) NULL )
252
274
continue ;
253
- if (strcmp (ll2 -> ll_label -> lab_text , name ) != 0 )
275
+ if (strcmp (ll2 -> ll_label -> lab_text , name ))
254
276
continue ;
255
277
256
278
/*
0 commit comments