aboutsummaryrefslogtreecommitdiff
path: root/scripts/mkflags.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/mkflags.c')
-rw-r--r--scripts/mkflags.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/scripts/mkflags.c b/scripts/mkflags.c
index b57f0577..e7ed684a 100644
--- a/scripts/mkflags.c
+++ b/scripts/mkflags.c
@@ -116,8 +116,8 @@ int main(int argc, char *argv[])
// See "intentionally crappy", above.
if (!(out = outbuf)) return 1;
- printf("#ifdef FORCE_FLAGS\n#define FORCED_FLAG 1\n"
- "#else\n#define FORCED_FLAG 0\n#endif\n\n");
+ printf("#ifdef FORCE_FLAGS\n#define FORCED_FLAG 1\n#define FORCED_FLAGLL 1LL\n"
+ "#else\n#define FORCED_FLAG 0\n#define FORCED_FLAGLL 0\n#endif\n\n");
for (;;) {
struct flag *flist, *aflist, *offlist;
@@ -173,27 +173,33 @@ int main(int argc, char *argv[])
out += strlen(out);
while (aflist) {
+ char *llstr = bit>31 ? "LL" : "";
+
+ // Output flag macro for bare longopts
if (aflist->lopt) {
if (flist && flist->lopt &&
!strcmp(flist->lopt->command, aflist->lopt->command))
{
- sprintf(out, "#define FLAG_%s (1<<%d)\n", flist->lopt->command, bit);
+ sprintf(out, "#define FLAG_%s (1%s<<%d)\n", flist->lopt->command,
+ llstr, bit);
flist->lopt = flist->lopt->next;
- } else sprintf(out, "#define FLAG_%s (FORCED_FLAG<<%d)\n",
- aflist->lopt->command, bit);
+ } else sprintf(out, "#define FLAG_%s (FORCED_FLAG%s<<%d)\n",
+ aflist->lopt->command, llstr, bit);
aflist->lopt = aflist->lopt->next;
if (!aflist->command) {
aflist = aflist->next;
bit++;
if (flist) flist = flist->next;
}
+ // Output normal flag macro
} else if (aflist->command) {
if (flist && (!flist->command || *aflist->command == *flist->command)) {
if (aflist->command)
- sprintf(out, "#define FLAG_%c (1<<%d)\n", *aflist->command, bit);
+ sprintf(out, "#define FLAG_%c (1%s<<%d)\n", *aflist->command,
+ llstr, bit);
flist = flist->next;
- } else sprintf(out, "#define FLAG_%c (FORCED_FLAG<<%d)\n",
- *aflist->command, bit);
+ } else sprintf(out, "#define FLAG_%c (FORCED_FLAG%s<<%d)\n",
+ *aflist->command, llstr, bit);
bit++;
aflist = aflist->next;
}