[PATCH] drm: Add deprecation warnings to the old midlayer callbacks

Emil Velikov emil.l.velikov at gmail.com
Thu Jun 1 18:25:46 UTC 2017


On 1 June 2017 at 14:00, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> Daniel started a crusade a few years back to move control over the
> initialisation and teardown into the driver rather than drm core, for
> greater control and far fewer surprises. Help in that fight by adding
> compiler warnings to the stale functions.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
>
> This is not as useful as I hoped. I wanted for gcc to emit a
> compile-time warning when a deprecated field was assigned, however it
> only emits when it is used. So we end up with a lot of noise in drm_core
> and none in the drivers. However, the runtime warning is probably useful
> and a motivator for change?
>
> Should be made WARN_ONCE though
>
I recall suggesting something similar a while back, but Daniel was not
too happy with it.
Hope it goes well this time.

On the assignment issue - if you declare a __deprecated type you will
get the warning [1]
A couple of small questions:
 - Why the separate configure toggle?
 - Most other places use type __deprecated function() and type
variable __deprecated;
Worth doing the same here - is it just sugar or there's something to it?

-Emil

[1] Small example

$cat dep.c
#define __deprecated __attribute__((deprecated))
typedef int FANCY __deprecated;

struct foo {
    FANCY i __deprecated;
} f1 = {
    .i = 100,
};

int
main(void)
{
    f1.i = 2;
    return 0;
}

$gcc -Wall -Wextra dep.c
dep.c:5:5: warning: ‘FANCY’ is deprecated [-Wdeprecated-declarations]
    FANCY i __deprecated;
    ^~~~~
dep.c: In function ‘main’:
dep.c:13:5: warning: ‘i’ is deprecated [-Wdeprecated-declarations]
    f1.i = 2;
    ^~
dep.c:5:11: note: declared here
    FANCY i __deprecated;
          ^


More information about the dri-devel mailing list