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)
Dec 24 2023, 1:57 AM
Unknown Object (File)
Dec 20 2023, 12:58 AM
Unknown Object (File)
Dec 8 2023, 11:55 PM
Unknown Object (File)
Nov 29 2023, 8:33 PM
Unknown Object (File)
Aug 4 2023, 3:15 PM
Unknown Object (File)
Jun 16 2023, 9:42 AM
Unknown Object (File)
Jun 3 2023, 5:35 PM
Unknown Object (File)
May 25 2023, 6:38 PM
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.