| @@ -495,15 +495,25 @@ header_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) · 494 unmodified lines |
| 495 | 495 | |
| 496 | 496 | switch (*value) { |
| 497 | 497 | case 'n': |
| 498 | | − return; |
| 498 | + break; |
| 499 | 499 | case 'm': |
| 500 | 500 | suffix = "_MODULE"; |
| 501 | 501 | /* fall through */ |
| 502 | 502 | default: |
| 503 | | − value = "1"; |
| 503 | + fprintf(fp, "#define %s%s%s 1\n", |
| 504 | + CONFIG_, sym->name, suffix); |
| 504 | 505 | } |
| 505 | | − fprintf(fp, "#define %s%s%s %s\n", |
| 506 | | − CONFIG_, sym->name, suffix, value); |
| 506 | + /* |
| 507 | + * Generate the __enabled_CONFIG_* and |
| 508 | + * __enabled_CONFIG_*_MODULE macros for use by the |
| 509 | + * IS_{ENABLED,BUILTIN,MODULE} macros. The _MODULE variant is |
| 510 | + * generated even for booleans so that the IS_ENABLED() macro |
| 511 | + * works. |
| 512 | + */ |
| 513 | + fprintf(fp, "#define __enabled_" CONFIG_ "%s %d\n", |
| 514 | + sym->name, (*value == 'y')); |
| 515 | + fprintf(fp, "#define __enabled_" CONFIG_ "%s_MODULE %d\n", |
| 516 | + sym->name, (*value == 'm')); |
| 507 | 517 | break; |
| 508 | 518 | } |
| 509 | 519 | case S_HEX: { |
| @@ -554,58 +564,6 @@ static struct conf_printer header_printer_cb = · 44 unmodified lines |
| 554 | 564 | .print_comment = header_print_comment, |
| 555 | 565 | }; |
| 556 | 566 | |
| 557 | | −/* |
| 558 | | − * Function-style header printer |
| 559 | | − * |
| 560 | | − * This printer is used to generate the config_is_xxx() function-style macros |
| 561 | | − * in `include/generated/autoconf.h' |
| 562 | | − */ |
| 563 | | −static void |
| 564 | | −header_function_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) |
| 565 | | −{ |
| 566 | | − int val = 0; |
| 567 | | − char c; |
| 568 | | − char *tmp, *d; |
| 569 | | − |
| 570 | | − switch (sym->type) { |
| 571 | | − case S_BOOLEAN: |
| 572 | | − case S_TRISTATE: |
| 573 | | − break; |
| 574 | | − default: |
| 575 | | − return; |
| 576 | | − } |
| 577 | | − if (*value == 'm') |
| 578 | | − val = 2; |
| 579 | | − else if (*value == 'y') |
| 580 | | − val = 1; |
| 581 | | − |
| 582 | | − d = strdup(CONFIG_); |
| 583 | | − tmp = d; |
| 584 | | − while ((c = *d)) { |
| 585 | | − *d = tolower(c); |
| 586 | | − d++; |
| 587 | | − } |
| 588 | | − |
| 589 | | − fprintf(fp, "#define %sis_", tmp); |
| 590 | | − free(tmp); |
| 591 | | − |
| 592 | | − d = strdup(sym->name); |
| 593 | | − tmp = d; |
| 594 | | − while ((c = *d)) { |
| 595 | | − *d = tolower(c); |
| 596 | | − d++; |
| 597 | | − } |
| 598 | | − fprintf(fp, "%s%s() %d\n", tmp, (val > 1) ? "_module" : "", |
| 599 | | − val ? 1 : 0); |
| 600 | | − free(tmp); |
| 601 | | −} |
| 602 | | − |
| 603 | | −static struct conf_printer header_function_printer_cb = |
| 604 | | −{ |
| 605 | | − .print_symbol = header_function_print_symbol, |
| 606 | | −}; |
| 607 | | − |
| 608 | | − |
| 609 | 567 | /* |
| 610 | 568 | * Tristate printer |
| 611 | 569 | * |
| @@ -997,7 +955,6 @@ int conf_write_autoconf(void) · 385 unmodified lines |
| 997 | 955 | conf_write_symbol(tristate, sym, &tristate_printer_cb, (void *)1); |
| 998 | 956 | |
| 999 | 957 | conf_write_symbol(out_h, sym, &header_printer_cb, NULL); |
| 1000 | | − conf_write_symbol(out_h, sym, &header_function_printer_cb, NULL); |
| 1001 | 958 | } |
| 1002 | 959 | fclose(out); |
| 1003 | 960 | fclose(tristate); |