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
F103237448: D7770.id.diff
Fri, Nov 22, 12:39 PM
Unknown Object (File)
Tue, Nov 19, 10:06 AM
Unknown Object (File)
Mon, Nov 18, 10:58 PM
Unknown Object (File)
Mon, Nov 18, 3:50 PM
Unknown Object (File)
Sun, Nov 17, 10:39 AM
Unknown Object (File)
Sat, Nov 16, 7:35 PM
Unknown Object (File)
Thu, Nov 14, 5:45 PM
Unknown Object (File)
Fri, Nov 8, 6:06 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.