diff options
-rw-r--r-- | idlc/CustomTarget_scanner.mk | 39 | ||||
-rw-r--r-- | idlc/Executable_idlc.mk | 5 | ||||
-rw-r--r-- | idlc/Module_idlc.mk | 1 | ||||
-rw-r--r-- | idlc/source/scanner.l (renamed from idlc/source/scanner.ll) | 2 | ||||
-rw-r--r-- | idlc/source/wrap_parser.cxx | 32 | ||||
-rw-r--r-- | idlc/source/wrap_scanner.cxx | 38 | ||||
-rw-r--r-- | solenv/gbuild/Executable.mk | 2 | ||||
-rw-r--r-- | solenv/gbuild/Library.mk | 2 | ||||
-rw-r--r-- | solenv/gbuild/LinkTarget.mk | 49 | ||||
-rw-r--r-- | solenv/gbuild/TargetLocations.mk | 5 |
10 files changed, 62 insertions, 113 deletions
diff --git a/idlc/CustomTarget_scanner.mk b/idlc/CustomTarget_scanner.mk deleted file mode 100644 index e7e3c2f6d668..000000000000 --- a/idlc/CustomTarget_scanner.mk +++ /dev/null @@ -1,39 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# Version: MPL 1.1 / GPLv3+ / LGPLv3+ -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License or as specified alternatively below. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# Major Contributor(s): -# Copyright (C) 2012 David Ostrovsky <d.ostrovsky@gmx.de> (initial developer) -# -# All Rights Reserved. -# -# For minor contributions see the git repository. -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 3 or later (the "GPLv3+"), or -# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -# instead of those above. - -$(eval $(call gb_CustomTarget_CustomTarget,idlc/scanner)) - -ICSC := $(call gb_CustomTarget_get_workdir,idlc/scanner) - -$(call gb_CustomTarget_get_target,idlc/scanner) : $(ICSC)/scanner.cxx - -$(ICSC)/scanner.cxx : $(ICSC)/stripped_scanner.ll - flex -o$@ $< - -$(ICSC)/stripped_scanner.ll : $(SRCDIR)/idlc/source/scanner.ll | $(ICSC)/.dir - tr -d "\015" < $< > $@ - -# vim:set shiftwidth=4 tabstop=4 noexpandtab: diff --git a/idlc/Executable_idlc.mk b/idlc/Executable_idlc.mk index 4319857d8cf7..32ecda6777ab 100644 --- a/idlc/Executable_idlc.mk +++ b/idlc/Executable_idlc.mk @@ -42,10 +42,11 @@ $(eval $(call gb_Executable_add_grammars,idlc,\ idlc/source/parser \ )) -$(eval $(call gb_Executable_use_custom_headers,idlc,idlc/scanner)) +$(eval $(call gb_Executable_add_scanners,idlc,\ + idlc/source/scanner \ +)) $(eval $(call gb_Executable_add_exception_objects,idlc,\ - idlc/source/wrap_scanner \ idlc/source/idlcmain \ idlc/source/idlc \ idlc/source/idlccompile \ diff --git a/idlc/Module_idlc.mk b/idlc/Module_idlc.mk index 3c963105f138..e1db3db1df66 100644 --- a/idlc/Module_idlc.mk +++ b/idlc/Module_idlc.mk @@ -27,7 +27,6 @@ $(eval $(call gb_Module_Module,idlc)) $(eval $(call gb_Module_add_targets,idlc,\ - CustomTarget_scanner \ Executable_idlc \ Executable_idlcpp \ )) diff --git a/idlc/source/scanner.ll b/idlc/source/scanner.l index 62ce2884f393..8d95322fc686 100644 --- a/idlc/source/scanner.ll +++ b/idlc/source/scanner.l @@ -257,7 +257,7 @@ static void parseLineAndFile(sal_Char* pBuf) // Suppress any warnings from generated code: #if defined __GNUC__ -#pragma GCC system_header +#pragma GCC diagnostic ignored "-Wunused-function" #elif defined __SUNPRO_CC #pragma disable_warn #elif defined _MSC_VER diff --git a/idlc/source/wrap_parser.cxx b/idlc/source/wrap_parser.cxx deleted file mode 100644 index 053713a21d90..000000000000 --- a/idlc/source/wrap_parser.cxx +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include "parser.cxx" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/idlc/source/wrap_scanner.cxx b/idlc/source/wrap_scanner.cxx deleted file mode 100644 index 94a068add789..000000000000 --- a/idlc/source/wrap_scanner.cxx +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifdef __clang__ -#pragma clang diagnostic ignored "-Wsign-compare" -#endif - -#include "scanner.cxx" - -void (*avoid_unused_yyunput_in_scanner_cxx)(int, char*) = yyunput; -int (*avoid_unused_yyinput_in_scanner_cxx)() = yyinput; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/solenv/gbuild/Executable.mk b/solenv/gbuild/Executable.mk index 8d565b6ee0a6..2cb23fc90b6d 100644 --- a/solenv/gbuild/Executable.mk +++ b/solenv/gbuild/Executable.mk @@ -85,6 +85,8 @@ $(eval $(foreach method,\ add_objcxxobjects \ add_grammar \ add_grammars \ + add_scanner \ + add_scanners \ add_exception_objects \ add_noexception_objects \ add_generated_cobjects \ diff --git a/solenv/gbuild/Library.mk b/solenv/gbuild/Library.mk index 4ba764e13858..2c74d6e70d2b 100644 --- a/solenv/gbuild/Library.mk +++ b/solenv/gbuild/Library.mk @@ -167,6 +167,8 @@ $(eval $(foreach method,\ use_library_objects \ add_grammar \ add_grammars \ + add_scanner \ + add_scanners \ add_cflags \ set_cflags \ add_cxxflags \ diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk index aa279bfb1c57..4b48f6784a26 100644 --- a/solenv/gbuild/LinkTarget.mk +++ b/solenv/gbuild/LinkTarget.mk @@ -28,6 +28,7 @@ #the following user-defined variables are supported: # YACCFLAGS +# LEXFLAGS # CPPFLAGS # CFLAGS # CXXFLAGS @@ -243,6 +244,34 @@ endef gb_YACC := bison +# LexTarget class + +gb_LexTarget_get_source = $(1)/$(2).l + +.PHONY : $(call gb_LexTarget_get_clean_target,%) +$(call gb_LexTarget_get_clean_target,%) : + $(call gb_Output_announce,$*,$(false),LEX,3) + $(call gb_Helper_abbreviate_dirs,\ + rm -f $(call gb_LexTarget_get_scanner_target,$*) $(call gb_LexTarget_get_target,$*)) + +$(call gb_LexTarget_get_target,%) : $(call gb_LexTarget_get_source,$(SRCDIR),%) + $(call gb_LexTarget__command,$<,$*,$@,$(call gb_LexTarget_get_scanner_target,$*)) + +# gb_LexTarget_LexTarget(scanner-file) +define gb_LexTarget_LexTarget +$(call gb_LexTarget_get_scanner_target,$(1)) :| $(call gb_LexTarget_get_target,$(1)) + +endef + +# gb_LexTarget__command(scanner-file, stem-for-message, done-pseudo-target, source-target) +define gb_LexTarget__command +$(call gb_Output_announce,$(2),$(true),LEX,3) +$(call gb_Helper_abbreviate_dirs,\ + mkdir -p $(dir $(3)) && \ + $(FLEX) $(T_LEXFLAGS) -o $(4) $(1) && touch $(3) ) +endef + + # ObjCxxObject class # @@ -453,6 +482,10 @@ $(call gb_LinkTarget_get_target,$(1)) : YACCOBJECT := $(call gb_LinkTarget_get_clean_target,$(1)) \ $(call gb_LinkTarget_get_target,$(1)) : T_YACCFLAGS := $$(gb_LinkTarget_YYACFLAGS) $(YACCFLAGS) $(call gb_LinkTarget_get_clean_target,$(1)) \ +$(call gb_LinkTarget_get_target,$(1)) : LEXOBJECT := +$(call gb_LinkTarget_get_clean_target,$(1)) \ +$(call gb_LinkTarget_get_target,$(1)) : T_LEXFLAGS := $$(gb_LinkTarget_LEXFLAGS) $(LEXFLAGS) +$(call gb_LinkTarget_get_clean_target,$(1)) \ $(call gb_LinkTarget_get_target,$(1)) : OBJCOBJECTS := $(call gb_LinkTarget_get_clean_target,$(1)) \ $(call gb_LinkTarget_get_target,$(1)) : OBJCXXOBJECTS := @@ -873,6 +906,22 @@ define gb_LinkTarget_add_grammars $(foreach grammar,$(2),$(call gb_LinkTarget_add_grammar,$(1),$(grammar),$(4))) endef +# Add a flex scanner to the build. +# gb_LinkTarget_add_scanner(<component>,<scanner file>) +define gb_LinkTarget_add_scanner +$(call gb_LexTarget_LexTarget,$(2)) +$(call gb_LinkTarget_add_generated_exception_object,$(1),LexTarget/$(2),$(3)) +$(call gb_LinkTarget_get_clean_target,$(1)) : $(call gb_LexTarget_get_clean_target,$(2)) + +endef + +# Add flex scanners to the build. +# gb_LinkTarget_add_scanners(<component>,<scanner file> [<scanner file>*]) +define gb_LinkTarget_add_scanners +$(foreach scanner,$(2),$(call gb_LinkTarget_add_scanner,$(1),$(scanner))) + +endef + define gb_LinkTarget_add_noexception_object $(call gb_LinkTarget_add_cxxobject,$(1),$(2),$(gb_LinkTarget_NOEXCEPTIONFLAGS) $(call gb_LinkTarget__get_cxxflags,$(3))) endef diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk index df694b74b780..70ec351e379b 100644 --- a/solenv/gbuild/TargetLocations.mk +++ b/solenv/gbuild/TargetLocations.mk @@ -141,6 +141,10 @@ gb_Configuration_get_target = $(WORKDIR)/Configuration/$(1).done gb_YaccTarget_get_grammar_target = $(WORKDIR)/YaccTarget/$(1).cxx gb_YaccTarget_get_header_target = $(WORKDIR)/YaccTarget/$(1).hxx gb_YaccTarget_get_target = $(WORKDIR)/YaccTarget/$(1).done + +gb_LexTarget_get_scanner_target = $(WORKDIR)/LexTarget/$(1).cxx +gb_LexTarget_get_target = $(WORKDIR)/LexTarget/$(1).done + gb_XcsTarget_get_target = $(WORKDIR)/XcsTarget/$(1) gb_XcuDataTarget_get_target = $(WORKDIR)/XcuDataTarget/$(1) gb_XcuLangpackTarget_get_target = $(WORKDIR)/XcuLangpackTarget/$(1) @@ -194,6 +198,7 @@ $(eval $(call gb_Helper_make_clean_targets,\ UnoApiTarget \ WinResTarget \ YaccTarget \ + LexTarget \ Zip \ XcsTarget \ XcuDataTarget \ |