Bug #2910
closedRethinking __printflike in the context of drm's __printf
0%
Description
Currently DragonFly drm defines printf to be __printflike. It seems likely to me that Linux drm actually expects behavior __printf0like, without the __nonnull(fmtarg) attribute.
For example, more recent versions of Linux drm want to define a function like this:
extern __printf(6, 7)
int drm_crtc_init_with_planes(struct drm_device *dev,
struct drm_crtc *crtc,
struct drm_plane *primary,
struct drm_plane *cursor,
const struct drm_crtc_funcs *funcs,
const char *name, ...);
and call it sometimes (well strangely enough, so far all of the time) with name == NULL.
Then inside the newer versions of the function is something like this:
if (name) {
__va_list ap;
__va_start(ap, name);
crtc->name = kvasprintf(GFP_KERNEL, name, ap);
__va_end(ap);
} else {
crtc->name = kasprintf(GFP_KERNEL, "crtc-%d",
drm_num_crtcs(dev));
}
The obvious fix is in sys/dev/drm/include/linux/compiler.h
to redefine __printf as __printf0like.
For curiosity's sake, given the gcc 4+ series of compilers now used for DragonFly in 2015
as opposed to 2004 when the __printflike and __printf0like distinction was made, is it
still necessary to have both __printflike and printf0like?