From 6ea09e0de40e30bd4ff4339726f36a0273970850 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Wed, 5 Aug 2020 22:54:53 +1000 Subject: [PATCH] Remove #ifdef MODULE_ETC guards for aux headers --- internal/cgen/aux/base.hh | 5 ----- internal/cgen/aux/json.hh | 5 ----- internal/cgen/data/data.go | 10 +++++----- release/c/wuffs-unsupported-snapshot.c | 10 ---------- 4 files changed, 5 insertions(+), 25 deletions(-) diff --git a/internal/cgen/aux/base.hh b/internal/cgen/aux/base.hh index 276ad8ea..e1aee481 100644 --- a/internal/cgen/aux/base.hh +++ b/internal/cgen/aux/base.hh @@ -19,8 +19,6 @@ // Auxiliary code is discussed at // https://github.com/google/wuffs/blob/master/doc/note/auxiliary-code.md -#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__AUX__BASE) - #include #include @@ -83,6 +81,3 @@ class MemoryInput : public Input { } // namespace sync_io } // namespace wuffs_aux - -#endif // !defined(WUFFS_CONFIG__MODULES) || - // defined(WUFFS_CONFIG__MODULE__AUX__BASE) diff --git a/internal/cgen/aux/json.hh b/internal/cgen/aux/json.hh index cab47bfe..56252510 100644 --- a/internal/cgen/aux/json.hh +++ b/internal/cgen/aux/json.hh @@ -16,8 +16,6 @@ // ---------------- Auxiliary - JSON -#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__AUX__JSON) - namespace wuffs_aux { struct DecodeJsonResult { @@ -78,6 +76,3 @@ DecodeJsonResult DecodeJson(DecodeJsonCallbacks&& callbacks, wuffs_base__slice_u32 quirks); } // namespace wuffs_aux - -#endif // !defined(WUFFS_CONFIG__MODULES) || - // defined(WUFFS_CONFIG__MODULE__AUX__JSON) diff --git a/internal/cgen/data/data.go b/internal/cgen/data/data.go index e09a71f5..ac383505 100644 --- a/internal/cgen/data/data.go +++ b/internal/cgen/data/data.go @@ -612,7 +612,7 @@ const AuxBaseCc = "" + "" const AuxBaseHh = "" + - "// ---------------- Auxiliary - Base\n\n// Auxiliary code is discussed at\n// https://github.com/google/wuffs/blob/master/doc/note/auxiliary-code.md\n\n#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__AUX__BASE)\n\n#include \n\n#include \n\nnamespace wuffs_aux {\n\nusing IOBuffer = wuffs_base__io_buffer;\n\nnamespace sync_io {\n\n" + + "// ---------------- Auxiliary - Base\n\n// Auxiliary code is discussed at\n// https://github.com/google/wuffs/blob/master/doc/note/auxiliary-code.md\n\n#include \n\n#include \n\nnamespace wuffs_aux {\n\nusing IOBuffer = wuffs_base__io_buffer;\n\nnamespace sync_io {\n\n" + "" + "// --------\n\nclass Input {\n public:\n virtual IOBuffer* BringsItsOwnIOBuffer();\n virtual std::string CopyIn(IOBuffer* dst) = 0;\n};\n\n" + "" + @@ -620,7 +620,7 @@ const AuxBaseHh = "" + "" + "// --------\n\n// MemoryInput is an Input that reads from an in-memory source.\n//\n// It does not take responsibility for freeing the memory when done.\nclass MemoryInput : public Input {\n public:\n MemoryInput(const uint8_t* ptr, size_t len);\n\n virtual IOBuffer* BringsItsOwnIOBuffer();\n virtual std::string CopyIn(IOBuffer* dst);\n\n private:\n IOBuffer m_io;\n\n // Delete the copy and assign constructors.\n MemoryInput(const MemoryInput&) = delete;\n MemoryInput& operator=(const MemoryInput&) = delete;\n};\n\n" + "" + - "// --------\n\n} // namespace sync_io\n\n} // namespace wuffs_aux\n\n#endif // !defined(WUFFS_CONFIG__MODULES) ||\n // defined(WUFFS_CONFIG__MODULE__AUX__BASE)\n" + + "// --------\n\n} // namespace sync_io\n\n} // namespace wuffs_aux\n" + "" const AuxJsonCc = "" + @@ -636,9 +636,9 @@ const AuxJsonCc = "" + "" const AuxJsonHh = "" + - "// ---------------- Auxiliary - JSON\n\n#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__AUX__JSON)\n\nnamespace wuffs_aux {\n\nstruct DecodeJsonResult {\n DecodeJsonResult(std::string&& error_message0, uint64_t cursor_position0);\n\n std::string error_message;\n uint64_t cursor_position;\n};\n\nclass DecodeJsonCallbacks {\n public:\n // AppendXxx are called for leaf nodes: literals, numbers and strings. For\n // strings, the Callbacks implementation is responsible for tracking map keys\n // versus other values.\n\n virtual std::string AppendNull() = 0;\n virtual std::string AppendBool(bool val) = 0;\n virtual std::string AppendI64(int64_t val) = 0;\n virtual std::string AppendF64(double val) = 0;\n virtual std::string AppendString(std::string&& val) = 0;\n\n // Push and Pop are called for container nodes: JSON arrays (lists) and JSON\n // objects (dictionaries).\n //\n // The flags bits combine exactly one of:\n // - WUFFS_BASE__TOKEN__VBD__STRUCTURE__FROM_NONE\n // - WUFFS_BASE__TOKEN__VBD__STRUCTU" + - "RE__FROM_LIST\n // - WUFFS_BASE__TOKEN__VBD__STRUCTURE__FROM_DICT\n // and exactly one of:\n // - WUFFS_BASE__TOKEN__VBD__STRUCTURE__TO_NONE\n // - WUFFS_BASE__TOKEN__VBD__STRUCTURE__TO_LIST\n // - WUFFS_BASE__TOKEN__VBD__STRUCTURE__TO_DICT\n\n virtual std::string Push(uint32_t flags) = 0;\n virtual std::string Pop(uint32_t flags) = 0;\n\n // Done is always the last Callback method called by DecodeJson, whether or\n // not parsing the input as JSON encountered an error. Even when successful,\n // trailing data may remain in input and buffer. See \"Unintuitive JSON\n // Parsing\" (https://nullprogram.com/blog/2019/12/28/) which discusses JSON\n // parsing and when it stops.\n //\n // Do not keep a reference to buffer or buffer.data.ptr after Done returns,\n // as DecodeJson may then de-allocate the backing array.\n virtual void Done(DecodeJsonResult& result,\n sync_io::Input& input,\n IOBuffer& buffer) = 0;\n};\n\n// DecodeJson calls callbacks based on the JSON-formatted data i" + - "n input.\n//\n// On success, the returned error_message is empty and cursor_position counts\n// the number of bytes consumed. On failure, error_message is non-empty and\n// cursor_position is the location of the error. That error may be a content\n// error (invalid JSON) or an input error (e.g. network failure).\nDecodeJsonResult DecodeJson(DecodeJsonCallbacks&& callbacks,\n sync_io::Input&& input,\n wuffs_base__slice_u32 quirks);\n\n} // namespace wuffs_aux\n\n#endif // !defined(WUFFS_CONFIG__MODULES) ||\n // defined(WUFFS_CONFIG__MODULE__AUX__JSON)\n" + + "// ---------------- Auxiliary - JSON\n\nnamespace wuffs_aux {\n\nstruct DecodeJsonResult {\n DecodeJsonResult(std::string&& error_message0, uint64_t cursor_position0);\n\n std::string error_message;\n uint64_t cursor_position;\n};\n\nclass DecodeJsonCallbacks {\n public:\n // AppendXxx are called for leaf nodes: literals, numbers and strings. For\n // strings, the Callbacks implementation is responsible for tracking map keys\n // versus other values.\n\n virtual std::string AppendNull() = 0;\n virtual std::string AppendBool(bool val) = 0;\n virtual std::string AppendI64(int64_t val) = 0;\n virtual std::string AppendF64(double val) = 0;\n virtual std::string AppendString(std::string&& val) = 0;\n\n // Push and Pop are called for container nodes: JSON arrays (lists) and JSON\n // objects (dictionaries).\n //\n // The flags bits combine exactly one of:\n // - WUFFS_BASE__TOKEN__VBD__STRUCTURE__FROM_NONE\n // - WUFFS_BASE__TOKEN__VBD__STRUCTURE__FROM_LIST\n // - WUFFS_BASE__TOKEN__VBD__STRUCTURE__FROM_DICT\n // and exact" + + "ly one of:\n // - WUFFS_BASE__TOKEN__VBD__STRUCTURE__TO_NONE\n // - WUFFS_BASE__TOKEN__VBD__STRUCTURE__TO_LIST\n // - WUFFS_BASE__TOKEN__VBD__STRUCTURE__TO_DICT\n\n virtual std::string Push(uint32_t flags) = 0;\n virtual std::string Pop(uint32_t flags) = 0;\n\n // Done is always the last Callback method called by DecodeJson, whether or\n // not parsing the input as JSON encountered an error. Even when successful,\n // trailing data may remain in input and buffer. See \"Unintuitive JSON\n // Parsing\" (https://nullprogram.com/blog/2019/12/28/) which discusses JSON\n // parsing and when it stops.\n //\n // Do not keep a reference to buffer or buffer.data.ptr after Done returns,\n // as DecodeJson may then de-allocate the backing array.\n virtual void Done(DecodeJsonResult& result,\n sync_io::Input& input,\n IOBuffer& buffer) = 0;\n};\n\n// DecodeJson calls callbacks based on the JSON-formatted data in input.\n//\n// On success, the returned error_message is empty and cursor_positio" + + "n counts\n// the number of bytes consumed. On failure, error_message is non-empty and\n// cursor_position is the location of the error. That error may be a content\n// error (invalid JSON) or an input error (e.g. network failure).\nDecodeJsonResult DecodeJson(DecodeJsonCallbacks&& callbacks,\n sync_io::Input&& input,\n wuffs_base__slice_u32 quirks);\n\n} // namespace wuffs_aux\n" + "" var AuxNonBaseCcFiles = []string{ diff --git a/release/c/wuffs-unsupported-snapshot.c b/release/c/wuffs-unsupported-snapshot.c index bb12c67c..1b57ea23 100644 --- a/release/c/wuffs-unsupported-snapshot.c +++ b/release/c/wuffs-unsupported-snapshot.c @@ -8288,8 +8288,6 @@ struct wuffs_zlib__decoder__struct { // Auxiliary code is discussed at // https://github.com/google/wuffs/blob/master/doc/note/auxiliary-code.md -#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__AUX__BASE) - #include #include @@ -8353,13 +8351,8 @@ class MemoryInput : public Input { } // namespace wuffs_aux -#endif // !defined(WUFFS_CONFIG__MODULES) || - // defined(WUFFS_CONFIG__MODULE__AUX__BASE) - // ---------------- Auxiliary - JSON -#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__AUX__JSON) - namespace wuffs_aux { struct DecodeJsonResult { @@ -8421,9 +8414,6 @@ DecodeJsonResult DecodeJson(DecodeJsonCallbacks&& callbacks, } // namespace wuffs_aux -#endif // !defined(WUFFS_CONFIG__MODULES) || - // defined(WUFFS_CONFIG__MODULE__AUX__JSON) - #endif // defined(__cplusplus) && (__cplusplus >= 201103L) // WUFFS C HEADER ENDS HERE.