Page MenuHomeFreeBSD

Define __OS_HAS_AGP in a more portable way
ClosedPublic

Authored by dim on Sep 3 2016, 11:19 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jul 23, 7:41 AM
Unknown Object (File)
Jun 29 2025, 1:46 PM
Unknown Object (File)
Jun 26 2025, 10:31 PM
Unknown Object (File)
Jun 14 2025, 8:57 PM
Unknown Object (File)
Jun 14 2025, 8:55 PM
Unknown Object (File)
Jun 7 2025, 6:48 AM
Unknown Object (File)
May 17 2025, 5:20 PM
Unknown Object (File)
May 5 2025, 8:11 AM
Subscribers

Details

Summary

Building the kernel with clang 3.9.0 produces the following new warnings
in drm2:

In file included from sys/dev/drm2/radeon/radeon_agp.c:31:
sys/dev/drm2/drmP.h:1141:5: warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]
#if __OS_HAS_AGP
    ^
sys/dev/drm2/drmP.h:106:23: note: expanded from macro '__OS_HAS_AGP'
#define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)))
                      ^
sys/dev/drm2/drmP.h:1141:5: warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]
sys/dev/drm2/drmP.h:106:47: note: expanded from macro '__OS_HAS_AGP'
#define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)))
                                              ^

Instead of defining __OS_HAS_AGP in this way, use the more portable way
of:

#if <condition>
#define __OS_HAS_AGP 1
#else
#define __OS_HAS_AGP 0
#endif

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dim retitled this revision from to Define __OS_HAS_AGP in a more portable way.
dim updated this object.
dim edited the test plan for this revision. (Show Details)
dim added reviewers: dumbbell, emaste.

Forgot to add that this also applies to __OS_HAS_MTRR, obviously.

dumbbell edited edge metadata.

Looks good to me. Thank you!

This revision is now accepted and ready to land.Sep 3 2016, 1:28 PM

We should also send this upstream (coordinating with the drm-next work) if it's still the same there

This revision was automatically updated to reflect the committed changes.

We should also send this upstream (coordinating with the drm-next work) if it's still the same there

I can't find __OS_HAS_AGP or __OS_HAS_MTRR defined anywhere in the drm-next-4.7 branch. However, __OS_HAS_AGP is used, but I don't remember the state of AGP support in drm-next.