Page MenuHomeFreeBSD

Allow for CSTD to be set kernel module Makefiles before inclusion
ClosedPublic

Authored by stevek on Sep 29 2023, 3:08 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jun 22, 3:21 PM
Unknown Object (File)
Fri, Jun 21, 12:46 AM
Unknown Object (File)
Thu, Jun 20, 11:57 PM
Unknown Object (File)
Thu, Jun 20, 11:07 PM
Unknown Object (File)
Fri, Jun 14, 3:57 PM
Unknown Object (File)
May 7 2024, 3:32 AM
Unknown Object (File)
Apr 23 2024, 7:22 AM
Unknown Object (File)
Apr 13 2024, 10:30 AM
Subscribers
None

Details

Summary

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.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

stevek created this revision.

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.

In D42019#958400, @imp wrote:

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.

Inching it up is probably fine, but ?= should still be used to facilitate experimentation

In D42019#958400, @imp wrote:

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.

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.)

In D42019#958400, @imp wrote:

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.

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.)

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.

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

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

As already noted, this makefile is used by kernel modules too.
The makefile generated by config(8) is not relevant.

In D42019#958439, @sjg wrote:

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

As already noted, this makefile is used by kernel modules too.
The makefile generated by config(8) is not relevant.

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.

In D42019#958439, @sjg wrote:

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

As already noted, this makefile is used by kernel modules too.
The makefile generated by config(8) is not relevant.

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.

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.
For example, if a module cannot build with the default CSTD currently (until the code is fixed to be able to), then it needs to be able to override.

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".
It's going to take some time for the code to be able to be changed to address the issues.

Note that the default CSTD assignment operator for bsd.sys.mk is ?=, therefore this change brings the kern.mk side into parity with it.

This revision is now accepted and ready to land.Sep 29 2023, 10:01 PM