From 0a3e9a41b1dbf7635865e3a9788075e11e5fc74b Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 30 Oct 2013 10:08:28 +0100 Subject: Remove the last C++ exceptions from QtQml Also clean up and compile the repository with exceptions disabled again. Change-Id: I653ae89353284b2f4ab884384f8ea6a5d100785d Reviewed-by: Simon Hausmann --- .qmake.conf | 17 ----------------- src/qml/jsruntime/jsruntime.pri | 2 -- src/qml/jsruntime/qv4script.cpp | 29 ++++------------------------- tools/qmljs/qmljs.pro | 2 -- 4 files changed, 4 insertions(+), 46 deletions(-) diff --git a/.qmake.conf b/.qmake.conf index 10a0930287..b0bc49d477 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -4,20 +4,3 @@ CONFIG += warning_clean MODULE_VERSION = 5.2.0 -# For the JS engine we need to be able to produce back traces, -# and as we're using the C stack, we need the system to be able -# to walk it properly. Unfortunately on Windows with i386 there -# are no unwind tables, that can compensate for an omitted frame -# pointer, so we have no choice but to disable the frame pointer -# omission optimizations. -# Only within the qtdeclarative module we support throwing V4 -# exceptions, hence the choice of applying this change here. -win32:equals(QT_ARCH, "i386") { - *msvc*: QMAKE_CXXFLAGS += -Oy- - *g++*: QMAKE_CXXFLAGS += -fno-omit-frame-pointer -} - -# Any code within this module has access to the private V4 API and -# can therefore be subject to exception traversal. Support for exceptions -# is therefore required, especially with older toolchains. -CONFIG += exceptions diff --git a/src/qml/jsruntime/jsruntime.pri b/src/qml/jsruntime/jsruntime.pri index 883205e92e..1809aa49e5 100644 --- a/src/qml/jsruntime/jsruntime.pri +++ b/src/qml/jsruntime/jsruntime.pri @@ -1,5 +1,3 @@ -CONFIG += exceptions - CONFIG += warn_off INCLUDEPATH += $$PWD diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp index a2d89a3278..6e2c26edaf 100644 --- a/src/qml/jsruntime/qv4script.cpp +++ b/src/qml/jsruntime/qv4script.cpp @@ -286,27 +286,6 @@ Function *Script::function() return vmFunction; } -struct PrecompilingCodeGen : public QQmlJS::Codegen -{ - struct CompileError {}; - - PrecompilingCodeGen(bool strict) - : QQmlJS::Codegen(strict) - {} - - virtual void throwSyntaxError(const QQmlJS::AST::SourceLocation &loc, const QString &detail) - { - QQmlJS::Codegen::throwSyntaxError(loc, detail); - throw CompileError(); - } - - virtual void throwReferenceError(const QQmlJS::AST::SourceLocation &loc, const QString &detail) - { - QQmlJS::Codegen::throwReferenceError(loc, detail); - throw CompileError(); - } -}; - CompiledData::CompilationUnit *Script::precompile(ExecutionEngine *engine, const QUrl &url, const QString &source, bool parseAsBinding, QList *reportedErrors) { using namespace QQmlJS; @@ -350,10 +329,10 @@ CompiledData::CompilationUnit *Script::precompile(ExecutionEngine *engine, const return 0; } - PrecompilingCodeGen cg(/*strict mode*/false); - try { - cg.generateFromProgram(url.toString(), source, program, &module, parseAsBinding ? QQmlJS::Codegen::QmlBinding : QQmlJS::Codegen::GlobalCode); - } catch (const PrecompilingCodeGen::CompileError &) { + QQmlJS::Codegen cg(/*strict mode*/false); + cg.generateFromProgram(url.toString(), source, program, &module, parseAsBinding ? QQmlJS::Codegen::QmlBinding : QQmlJS::Codegen::GlobalCode); + errors = cg.errors(); + if (!errors.isEmpty()) { if (reportedErrors) *reportedErrors << cg.errors(); return 0; diff --git a/tools/qmljs/qmljs.pro b/tools/qmljs/qmljs.pro index c67bb9caaf..3f984951f3 100644 --- a/tools/qmljs/qmljs.pro +++ b/tools/qmljs/qmljs.pro @@ -4,6 +4,4 @@ SOURCES = main.cpp include($$PWD/../../src/3rdparty/masm/masm-defs.pri) -CONFIG += exceptions - load(qt_tool) -- cgit v1.2.3