Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9ba47d81 authored by Adam Lesinski's avatar Adam Lesinski
Browse files

Filter products during compile phase

Unfortunately there is no good way to deal with products in the link phase.
Products are like preprocessor defines in that they are processed early
and change the composition of the compiled unit.

Change-Id: I6d5e15ef60d29df8e83e059ba857c09333993779
parent 072c5bdf
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -51,12 +51,6 @@ public:
        mMessage << value;
        return *this;
    }
/*
    template <typename T> DiagMessage& operator<<(
            const ::std::function<::std::ostream&(::std::ostream&)>& f) {
        f(mMessage);
        return *this;
    }*/

    DiagMessageActual build() const {
        return DiagMessageActual{ mSource, mMessage.str() };
@@ -72,6 +66,8 @@ struct IDiagnostics {
};

struct StdErrDiagnostics : public IDiagnostics {
    size_t mNumErrors = 0;

    void emit(const DiagMessage& msg, const char* tag) {
        DiagMessageActual actual = msg.build();
        if (!actual.source.path.empty()) {
@@ -81,8 +77,11 @@ struct StdErrDiagnostics : public IDiagnostics {
    }

    void error(const DiagMessage& msg) override {
        if (mNumErrors < 20) {
            emit(msg, "error: ");
        }
        mNumErrors++;
    }

    void warn(const DiagMessage& msg) override {
        emit(msg, "warn: ");
+7 −0
Original line number Diff line number Diff line
@@ -78,6 +78,9 @@ struct ResourceName {
    ResourceType type;
    std::u16string entry;

    ResourceName() = default;
    ResourceName(const StringPiece16& p, ResourceType t, const StringPiece16& e);

    bool isValid() const;
    bool operator<(const ResourceName& rhs) const;
    bool operator==(const ResourceName& rhs) const;
@@ -226,6 +229,10 @@ inline ::std::ostream& operator<<(::std::ostream& out, const ResourceType& val)
// ResourceName implementation.
//

inline ResourceName::ResourceName(const StringPiece16& p, ResourceType t, const StringPiece16& e) :
        package(p.toString()), type(t), entry(e.toString()) {
}

inline bool ResourceName::isValid() const {
    return !package.empty() && !entry.empty();
}
+190 −116

File changed.

Preview size limit exceeded, changes collapsed.

+23 −13

File changed.

Preview size limit exceeded, changes collapsed.

+43 −3

File changed.

Preview size limit exceeded, changes collapsed.

Loading