Page MenuHomeFreeBSD

Make #if and #endif do what people expect in *_if.m
ClosedPublic

Authored by andrew on Oct 5 2022, 9:19 AM.
Tags
None
Referenced Files
F103736584: D36882.diff
Thu, Nov 28, 6:00 PM
Unknown Object (File)
Mon, Nov 25, 10:00 AM
Unknown Object (File)
Thu, Nov 14, 2:17 PM
Unknown Object (File)
Sep 30 2024, 6:49 PM
Unknown Object (File)
Sep 30 2024, 6:49 PM
Unknown Object (File)
Sep 30 2024, 6:49 PM
Unknown Object (File)
Sep 30 2024, 6:49 PM
Unknown Object (File)
Sep 30 2024, 6:37 PM
Subscribers

Details

Summary

These are used in a few places. Pass them to the generated .c and .h
files to allow us to build the parts of the interface the kernel config
supports.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 47695
Build 44582: arc lint + arc unit

Event Timeline

andrew requested review of this revision.Oct 5 2022, 9:19 AM
imp requested changes to this revision.Oct 5 2022, 1:08 PM
imp added inline comments.
sys/tools/makeobjops.awk
469

I'd be tempted here just to pass through all # lines.

But if not, don't you also need #elif here?

This revision now requires changes to proceed.Oct 5 2022, 1:08 PM
sys/tools/makeobjops.awk
469

We can't pass them all through as they are used as comments in these files. I can add #elif, although we only ever use #if, #else and #endif in current .m files.

sys/tools/makeobjops.awk
469

Ah, right. I'm used to old-school cpp which ignored the directives it didn't understand :)

Do we need to worry about #define and #undef too?

sys/tools/makeobjops.awk
469

I don't think so, those should be placed in the HEADER block which already passes everything through, e.g. as is done in sys/geom/raid/g_raid_tr_if.m

This revision is now accepted and ready to land.Oct 5 2022, 7:09 PM

This is a useful feature. Will this be MFCed to stable/13 and stable/12 ?

I hadn't planned on a MFC as I'm unsure what .m files would break (and if there are any out of tree files I don't have access to)

I hadn't planned on a MFC as I'm unsure what .m files would break (and if there are any out of tree files I don't have access to)

I did some search on stable/13 trees:

find . -type f -name "*.m" -exec egrep '^#(if)|(^#else)|(^#elif)|(^#end)' {} \; -print

#if __GNUC_PREREQ__(4,8)
#endif
#if __GNUC_PREREQ__(4,8)
#endif
#if __GNUC_PREREQ__(4,8)
#endif
./contrib/netbsd-tests/lib/libobjc/t_threads.m
#ifdef SMP
#else
#endif
./sys/powerpc/powerpc/platform_if.m
#ifdef FDT
#endif
#ifdef FDT
#endif
./sys/dev/extres/regulator/regdev_if.m
#ifdef FDT
#endif
#ifdef FDT
#endif
./sys/dev/extres/hwreset/hwreset_if.m
#ifdef FDT
#endif
#ifdef FDT
#endif
./sys/dev/extres/phy/phydev_if.m
#ifdef FDT
#endif
./sys/dev/xdma/xdma_if.m

I think it is right to MFC . It will fix sys/powerpc/powerpc/platform_if.m .

        static struct cpu_group *platform_null_smp_topo(platform_t plat)
        {
#ifdef SMP
                return (smp_topo_none());
#else
                return (NULL);
#endif
        }

CC @jhibbits .

(and if there are any out of tree files I don't have access to)

I do not quite understand that. Do you mean some .m files in ports or third party ?