diff options
Diffstat (limited to 'bin/update_pch')
-rwxr-xr-x | bin/update_pch | 75 |
1 files changed, 46 insertions, 29 deletions
diff --git a/bin/update_pch b/bin/update_pch index 7411e79acb80..fcac5b0e4711 100755 --- a/bin/update_pch +++ b/bin/update_pch @@ -73,6 +73,7 @@ DEFAULTS = \ 'desktop.deploymentgui' : ( 3, EXCLUDE, EXCLUDE, EXCLUDE), # 5.7 'desktop.deploymentmisc' : ( 3, EXCLUDE, EXCLUDE, EXCLUDE), # 3.4 'desktop.sofficeapp' : ( 6, EXCLUDE, INCLUDE, INCLUDE), # 6.5 + 'docmodel.docmodel' : ( 3, EXCLUDE, EXCLUDE, INCLUDE), # 3.8 'drawinglayer.drawinglayer' : ( 4, EXCLUDE, EXCLUDE, EXCLUDE), # 7.4 'editeng.editeng' : ( 5, EXCLUDE, INCLUDE, EXCLUDE), # 13.0 'forms.frm' : ( 2, EXCLUDE, EXCLUDE, EXCLUDE), # 14.2 @@ -108,6 +109,7 @@ DEFAULTS = \ 'sw.sw' : ( 7, EXCLUDE, EXCLUDE, INCLUDE), # 129.6 'sw.swui' : ( 3, EXCLUDE, INCLUDE, INCLUDE), # 26.1 'sw.vbaswobj' : ( 4, EXCLUDE, INCLUDE, INCLUDE), # 13.1 + 'sw.sw_writerfilter' : ( 5, EXCLUDE, EXCLUDE, EXCLUDE), # 19.7/27.3 'tools.tl' : ( 5, EXCLUDE, EXCLUDE, EXCLUDE), # 4.2 'unotools.utl' : ( 3, EXCLUDE, EXCLUDE, INCLUDE), # 7.0 'unoxml.unoxml' : ( 1, EXCLUDE, EXCLUDE, EXCLUDE), # 4.6 @@ -115,7 +117,6 @@ DEFAULTS = \ 'vbahelper.msforms' : ( 3, EXCLUDE, INCLUDE, INCLUDE), # 5.2 'vbahelper.vbahelper' : ( 3, EXCLUDE, EXCLUDE, INCLUDE), # 7.0 'vcl.vcl' : ( 6, EXCLUDE, INCLUDE, INCLUDE), # 35.7 - 'writerfilter.writerfilter' : ( 5, EXCLUDE, EXCLUDE, EXCLUDE), # 19.7/27.3 'xmloff.xo' : ( 7, EXCLUDE, INCLUDE, INCLUDE), # 22.1 'xmloff.xof' : ( 1, EXCLUDE, EXCLUDE, INCLUDE), # 4.4 'xmlscript.xmlscript' : ( 4, EXCLUDE, EXCLUDE, INCLUDE), # 3.6 @@ -176,7 +177,7 @@ def find_files(path, recurse=True): def get_filename(line): """ Strips the line from the - '#include' and angled brakets + '#include' and angled brackets and return the filename only. """ if not len(line) or line[0] != '#': @@ -372,15 +373,9 @@ def filter_ignore(line, module): 'LibreOfficeKit/LibreOfficeKitTypes.h', # Needs special directives 'jerror.h', # c++ unfriendly 'jpeglib.h', # c++ unfriendly - 'boost/spirit/include/classic_core.hpp', # depends on BOOST_SPIRIT_DEBUG - 'svtools/editimplementation.hxx' # no direct include + 'boost/spirit/include/classic_core.hpp' # depends on BOOST_SPIRIT_DEBUG ] - if module == 'accessibility': - ignore_list += [ - # STR_SVT_ACC_LISTENTRY_SELCTED_STATE redefined from svtools.hrc - 'accessibility/extended/textwindowaccessibility.hxx', - ] if module == 'basic': ignore_list += [ 'basic/vbahelper.hxx', @@ -443,7 +438,6 @@ def filter_ignore(line, module): if module == 'xmlsecurity': ignore_list += [ 'xmlsec/*', - 'xmlsecurity/xmlsec-wrapper.h', ] if module == 'external/pdfium': ignore_list += [ @@ -480,6 +474,14 @@ def filter_ignore(line, module): 'src/sksl/SkSLCPP.h', 'src/gpu/vk/GrVkAMDMemoryAllocator.h', 'src/gpu/GrUtil.h', + 'src/sksl/', # conflict between SkSL::Expression and SkSL::dsl::Expression + 'include/sksl/', + 'src/gpu/vk/', + 'include/gpu/vk' + ] + if module == 'external/zxing': + ignore_list += [ + 'rss/ODRSSExpandedBinaryDecoder.h' ] for i in ignore_list: @@ -517,6 +519,8 @@ def fixup(includes, module): except: fixes.append(inc) + append('sal/config.h') + if module == 'basctl': if 'basslots.hxx' in includes: append('sfx2/msg.hxx') @@ -540,6 +544,8 @@ def sort_by_category(list, root, module, filter_local): prefix = '<' + module + '/' for i in list: + if 'sal/config.h' in i: + continue # added unconditionally in fixup if is_c_runtime(i, root, module): sys.append(i) elif '<boost/' in i: @@ -691,9 +697,15 @@ def is_allowed_if(line, module): # Our sources always build with LIBO_INTERNAL_ONLY. if line == "#if defined LIBO_INTERNAL_ONLY" or line == "#ifdef LIBO_INTERNAL_ONLY": return True + # We use PCHs only for C++. + if line == "#if defined(__cplusplus)" or line == "#if defined __cplusplus": + return True + # Debug-specific code, it shouldn't hurt including it unconditionally. + if line == "#ifdef DBG_UTIL" or line == "#if OSL_DEBUG_LEVEL > 0": + return True if module == "external/skia": # We always set these. - if line == "#ifdef SK_VULKAN" or line == "#if SK_SUPPORT_GPU": + if line == "#ifdef SK_VULKAN" or line == "#if SK_GANESH": return True return False @@ -728,6 +740,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) @@ -870,10 +888,8 @@ def generate(includes, libname, filename, module): if module == 'sal' and libname == 'sal': sal_define = """ #if defined(_WIN32) -#if !defined _CRT_RAND_S #define _CRT_RAND_S #endif -#endif """ f.write(sal_define) @@ -1108,7 +1124,8 @@ def main(): return 0 # Didn't update. - return 1 + # Use exit code 2 to distinguish it from exit code 1 used e.g. when an exception occurs. + return 2 if __name__ == '__main__': """ Process all the includes in a Module @@ -1174,8 +1191,8 @@ class TestMakefileParser(unittest.TestCase): def test_parse_multiline_eval(self): source = """$(eval $(call gb_Library_set_include,sal,\\ - $$(INCLUDE) \\ - -I$(SRCDIR)/sal/inc \\ + $$(INCLUDE) \\ + -I$(SRCDIR)/sal/inc \\ )) """ lines = source.split('\n') @@ -1186,9 +1203,9 @@ class TestMakefileParser(unittest.TestCase): def test_parse_multiline_eval_with_if(self): source = """$(eval $(call gb_Library_add_defs,sal,\\ - $(if $(filter $(OS),iOS), \\ - -DNO_CHILD_PROCESSES \\ - ) \\ + $(if $(filter $(OS),iOS), \\ + -DNO_CHILD_PROCESSES \\ + ) \\ )) """ lines = source.split('\n') @@ -1199,7 +1216,7 @@ class TestMakefileParser(unittest.TestCase): def test_parse_multiline_add_with_if(self): source = """$(eval $(call gb_Library_add_exception_objects,sal,\\ - sal/osl/unx/time \\ + sal/osl/unx/time \\ $(if $(filter DESKTOP,$(BUILD_TYPE)), sal/osl/unx/salinit) \\ )) """ @@ -1213,11 +1230,11 @@ class TestMakefileParser(unittest.TestCase): def test_parse_if_else(self): source = """ifeq ($(OS),MACOSX) $(eval $(call gb_Library_add_exception_objects,sal,\\ - sal/osl/mac/mac \\ + sal/osl/mac/mac \\ )) else $(eval $(call gb_Library_add_exception_objects,sal,\\ - sal/osl/unx/uunxapi \\ + sal/osl/unx/uunxapi \\ )) endif """ @@ -1234,16 +1251,16 @@ endif def test_parse_nested_if(self): source = """ifeq ($(OS),MACOSX) $(eval $(call gb_Library_add_exception_objects,sal,\\ - sal/osl/mac/mac \\ + sal/osl/mac/mac \\ )) else $(eval $(call gb_Library_add_exception_objects,sal,\\ - sal/osl/unx/uunxapi \\ + sal/osl/unx/uunxapi \\ )) ifeq ($(OS),LINUX) $(eval $(call gb_Library_add_exception_objects,sal,\\ - sal/textenc/context \\ + sal/textenc/context \\ )) endif endif @@ -1263,16 +1280,16 @@ endif def test_parse_exclude_system(self): source = """ifeq ($(OS),MACOSX) $(eval $(call gb_Library_add_exception_objects,sal,\\ - sal/osl/mac/mac \\ + sal/osl/mac/mac \\ )) else $(eval $(call gb_Library_add_exception_objects,sal,\\ - sal/osl/unx/uunxapi \\ + sal/osl/unx/uunxapi \\ )) ifeq ($(OS),LINUX) $(eval $(call gb_Library_add_exception_objects,sal,\\ - sal/textenc/context \\ + sal/textenc/context \\ )) endif endif @@ -1289,7 +1306,7 @@ endif def test_parse_filter(self): source = """ifneq ($(filter $(OS),MACOSX iOS),) $(eval $(call gb_Library_add_exception_objects,sal,\\ - sal/osl/unx/osxlocale \\ + sal/osl/unx/osxlocale \\ )) endif """ |