linux 这么大的工程,当你的模块和别人的模块公用一个框架比如DRM
祖爷爷级别的Makefile 给你规定了 -Werror=incompatible-pointer-types
这个时候你又不想用它怎么办呢
就是在你的代码里加上
#pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
搞定
例如
/home/ubuntu/jammy/drivers/gpu/drm/xxx/xxx_crtc.c:729:27: note: (near initialization for ‘phytium_crtc_helper_funcs.atomic_enable’)
/home/ubuntu/jammy/drivers/gpu/drm/xxx/xxx_crtc.c:730:27: error: initialization of ‘void (*)(struct drm_crtc *, struct drm_atomic_state *)’ from incompatible pointer type ‘void (*)(struct drm_crtc *, struct drm_crtc_state *)’ [-Werror=incompatible-pointer-types]
730 | .atomic_disable = xxx_crtc_atomic_disable,