From: "Ozkan Sezer (sezeroz@gmail.com) [via djgpp@delorie.com]" <djgpp@delorie.com>
Date: Mon, 30 Jan 2023 20:27:51 +0300
The patch inlined below (also attached for convenience) adds support for using an exports file to dxe3gen.
The existing mechanism for exported symbols is through symbol prefixes,
i.e. the -E and -X switches, but can be really hard to use especially if there are many symbols which don't necessarily share a common prefix, or
if some of the symbols to exclude share the common prefix with symbols
to export.
The exports file is a plain text file with one symbol name at each line,
like an exports file that can be used in macOS projects. No trailing or leading space/tab should be used in the file. A line starting with a '#' character is a comment line and will be ignored.
The -E and -X switches are still supported, but those two are mutually exclusive.
Eli, Juan, DJ: Please review. OK to apply?
LGTM,
but why did you use binary mode for reading the exports file?
LGTM,
OK, can apply tomorrow unless I get further reviews/objections.
but why did you use binary mode for reading the exports file?
Easier forme that way -- uniform parsing across platforms.
LGTM,
OK, can apply tomorrow unless I get further reviews/objections.
but why did you use binary mode for reading the exports file?
Easier forme that way -- uniform parsing across platforms.
Version 2 of patch attached. Changes:
- Fixes segfault if the exports file has no newline at end
- Reports missing exports in verbose mode.
For convenience, an interdiff to first version is inlined below
(cosmetic changes excluded.)
--- dxe3gen.c~
+++ dxe3gen.c
@@ -519,7 +520,7 @@
opt.export_names[opt.num_names++] = ptr++;
loc1:
- while (*ptr != '\r' && *ptr != '\n')
+ while (*ptr && *ptr != '\r' && *ptr != '\n')
++ptr;
}
}
@@ -1277,9 +1278,12 @@
BOOL ok = FALSE;
for (j = 0; j < opt.num_names; j++)
{
+ if (!opt.export_names[j])
+ continue;
if (strcmp(opt.export_names[j], name) == 0)
{
ok = TRUE;
+ opt.export_names[j] = NULL;
break;
}
}
@@ -1310,6 +1314,15 @@
}
DEBUG_PRINT_SYMBOL_TABLE_EPILOG();
+ if (opt.verbose && opt.num_names && opt.num_names != dh.n_exp_syms)
+ {
+ for (j = 0; j < opt.num_names; j++)
+ {
+ if (opt.export_names[j])
+ printf("missing export: `%s'\n", opt.export_names[j]);
+ }
+ }
+
if (errcount)
{
fclose(outf);
If you guys don't catch any gotchas, I plan to apply this 3r version to
cvs.
Question: Should I actually make any missing exports an error ?
Patch inlined below.
Unless this is a real problem,
I'd say do this only under the verbose operation, i.e. optionally.
From: "Ozkan Sezer (sezeroz@gmail.com) [via djgpp@delorie.com]" <djgpp@delorie.com>
Date: Tue, 31 Jan 2023 22:10:28 +0300
I'd say do this only under the verbose operation, i.e. optionally.
i.e. error out only in verbose mode, which _can_ lead to problems?
I' suggest inventing a new switch like --nomissing, what do you think?
From: "Ozkan Sezer (sezeroz@gmail.com) [via djgpp@delorie.com]"
<djgpp@delorie.com>
Date: Tue, 31 Jan 2023 22:10:28 +0300
I'd say do this only under the verbose operation, i.e. optionally.
i.e. error out only in verbose mode, which _can_ lead to problems?
I' suggest inventing a new switch like --nomissing, what do you think?
SGTM.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 365 |
Nodes: | 16 (2 / 14) |
Uptime: | 31:43:50 |
Calls: | 7,790 |
Files: | 12,917 |
Messages: | 5,750,911 |