summaryrefslogtreecommitdiff
path: root/bin/update_pch
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-04-08 13:41:30 +0200
committerLuboš Luňák <l.lunak@collabora.com>2021-04-08 17:22:14 +0200
commit15a0bdd32df89aa8d2e5ab49e07061f0708651e6 (patch)
tree5fa55d068947a826571184c92d3a3e9436f3ff1a /bin/update_pch
parent9cd313228477f0b471f759e3e71810ddae8654e4 (diff)
make update_pch.sh aware of '#pragma once'
Headers are allowed to have one #if block that is not ignored, on the assumption that it is the include guard. This shouldn't be the case if the header uses #pragma once, obviously. Change-Id: Ib0aa0933ce224ca4e3ecf209593852da0f4ca5ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113799 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'bin/update_pch')
-rwxr-xr-xbin/update_pch6
1 files changed, 6 insertions, 0 deletions
diff --git a/bin/update_pch b/bin/update_pch
index 9b541d8a87a9..974d53ab9197 100755
--- a/bin/update_pch
+++ b/bin/update_pch
@@ -727,6 +727,12 @@ def process_source(root, module, filename, maxdepth=0):
else:
lastif = '#if'
del allowed_ifs[ ifdepth ]
+ elif line.startswith('#pragma once'):
+ # maxdepth == 1 means we are parsing a header file
+ # and are allowed one #ifdef block (the include guard),
+ # but in the #pragma once case do not allow that
+ assert maxdepth == 1
+ maxdepth = 0
elif line.startswith('#include'):
if ifdepth - ifsallowed <= maxdepth:
line = sanitize(line)