aboutsummaryrefslogtreecommitdiff
path: root/scripts/clean-header-guards.pl
AgeCommit message (Collapse)AuthorFilesLines
2022-07-05disas: Remove libvixl disassemblerThomas Huth1-2/+2
The disassembly via capstone should be superiour to our old vixl sources nowadays, so let's finally cut this old disassembler out of the QEMU source tree. Message-Id: <20220603164249.112459-1-thuth@redhat.com> Tested-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Thomas Huth <thuth@redhat.com>
2020-09-17scripts/: fix some comment spelling errorszhaolichang1-1/+1
I found that there are many spelling errors in the comments of qemu, so I used the spellcheck tool to check the spelling errors and finally found some spelling errors in the scripts folder. Signed-off-by: zhaolichang <zhaolichang@huawei.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20200917075029.313-5-zhaolichang@huawei.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-06-12scripts/clean-header-guards: Fix handling of trailing commentsMarkus Armbruster1-5/+7
clean-header-guards.pl fails to recognize a header guard #endif when it's followed by a // comment, or multiple comments. Fix that. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20190604181618.19980-3-armbru@redhat.com>
2017-05-10scripts: Switch to more portable Perl shebangKamil Rytarowski1-1/+2
The default NetBSD package manager is pkgsrc and it installs Perl along other third party programs under custom and configurable prefix. The default prefix for binary prebuilt packages is /usr/pkg, and the Perl executable lands in /usr/pkg/bin/perl. This change switches "/usr/bin/perl" to "/usr/bin/env perl" as it's the most portable solution that should work for almost everybody. Perl's executable is detected automatically. This change switches -w option passed to the executable with more modern "use warnings;" approach. There is no functional change to the default behavior. Signed-off-by: Kamil Rytarowski <n54@gmx.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2016-07-12scripts: New clean-header-guards.plMarkus Armbruster1-0/+213
The conventional way to ensure a header can be included multiple times is to bracket it like this: #ifndef HEADER_NAME_H #define HEADER_NAME_H ... #endif where HEADER_NAME_H is a symbol unique to this header. The endif may be optionally decorated like this: #endif /* HEADER_NAME_H */ Unconventional ways present in our code: * Identifiers reserved for any use: #define _FILEOP_H * Lowercase (bad idea for object-like macros): #define __linux_video_vga_h__ * Roundabout ways to say the same thing (and hide from grep): #if !defined(__PPC_MAC_H__) #endif /* !defined(__PPC_MAC_H__) */ * Redundant values: #define HW_ALPHA_H 1 * Funny redundant values: # define PXA_H "pxa.h" * Decorations with bangs: #endif /* !QEMU_ARM_GIC_INTERNAL_H */ The negation actually makes sense, but almost all our header guard #endif decorations don't negate. * Useless decorations: #endif /* audio.h */ Header guards are not the place to show off creativity. This script normalizes them to the conventional way, and cleans up whitespace while there. It warns when it renames guard symbols, and explains how to find occurences of these symbols that may have to be updated manually. Another issue is use of the same guard symbol in multiple headers. That's okay only for headers that cannot be used together, such as the *-user/*/target_syscall.h. This script can't tell, so it warns when it sees a reuse. The script also warns when preprocessing a header with its guard symbol defined produces anything but whitespace. The next commits will put the script to use. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>