On 26 September 2016 at 12:58, <riku.voi...@linaro.org> wrote: > From: Riku Voipio <riku.voi...@linaro.org> > > Linux-user and bsd-user code needs lots of arch-specific ifdefs, > so disable the warning. > > Signed-off-by: Riku Voipio <riku.voi...@linaro.org> > --- > scripts/checkpatch.pl | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index dde3f5f..98a007f 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -2405,8 +2405,9 @@ sub process { > } > # check of hardware specific defines > # we have e.g. CONFIG_LINUX and CONFIG_WIN32 for common cases > -# where they might be necessary. > - if ($line =~ m@^.\s*\#\s*if.*\b__@) { > +# where they might be necessary. Skip test on linux-user and bsd-user > +# where arch defines are needed > + if (!($realfile =~ /^(linux|bsd)-user/) && $line =~ > m@^.\s*\#\s*if.*\b__@) { > ERROR("architecture specific defines should be > avoided\n" . $herecurr); > }
Do you have some examples of the false positives you want to suppress here? For new code I would hope that we can handle host-arch-specifics by having new files (or just new #defines etc) in linux-user/host/$ARCH/ rather than inline #ifdeffery in the main files. thanks -- PMM