Use ?= when setting the default value for CSTD so it can be set by
Makefiles before inclusion and not be overridden by the .mk file.
Obtained from: Juniper Networks, Inc.
Differential D42019
Allow for CSTD to be set kernel module Makefiles before inclusion stevek on Sep 29 2023, 3:08 PM. Authored by Tags None Referenced Files
Subscribers None
Details Use ?= when setting the default value for CSTD so it can be set by Obtained from: Juniper Networks, Inc.
Diff Detail
Event TimelineComment Actions I've been running with this set to c11.... What do you want to set higher? And what do people think about just inching this up across the board. Comment Actions Inching it up is probably fine, but ?= should still be used to facilitate experimentation Comment Actions There may be cases where someone needs to adjust the value while experimenting or when they have some kernel module that doesn't build successfully/correctly with the default setting (usually in the interim before they finally fix it.) Comment Actions I'm looking for concrete instances. I think this is a great idea... but it dovetails to other things we also need to think about. So +1 on ?= for sure. Just wondering if the time is finally ripe to jump to c11. Comment Actions Given conf generates one big Makefile for the entire kernel, and thus CSTD is global for everything compiled into the kernel, I'm unsure how sensible this really is Comment Actions As already noted, this makefile is used by kernel modules too. Comment Actions Yes, but typically modules can also be compiled into the kernel, where you need to use -std= explicitly. I don't object to it going in, I just don't see it being all that useful. Comment Actions It's useful for folks like us that build additional kernel modules downstream. We utilize the .mk infrastructure from FreeBSD, but there are cases where one needs to override the defaults. Comment Actions I should also note that we currently have at least one case of this in our source tree currently, which is what prompted the change. It compiles fine with "c99", but does not with "gnu99". Note that the default CSTD assignment operator for bsd.sys.mk is ?=, therefore this change brings the kern.mk side into parity with it. |