From eadd345d3580b6fe5ca07b8ff20db810e6d22cb3 Mon Sep 17 00:00:00 2001 From: Boxiao Cao Date: Tue, 16 Mar 2021 16:24:19 -0400 Subject: [PATCH] define GLOB_TILDE in fileutil.cc (#33304) PiperOrigin-RevId: 361882155 Co-authored-by: Googler --- validator/cpp/htmlparser/fileutil.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/validator/cpp/htmlparser/fileutil.cc b/validator/cpp/htmlparser/fileutil.cc index d6db39ba3487..080acce9484a 100644 --- a/validator/cpp/htmlparser/fileutil.cc +++ b/validator/cpp/htmlparser/fileutil.cc @@ -26,6 +26,18 @@ #include "defer.h" #include "strings.h" +// TODO(caoboxiao) +// The Macro `GLOB_TILDE` is not defined in the WebAssembly environment because +// WebAssembly does not have the file system, so we have to define this MACRO in +// order to have this file successfully compiled in WebAssembly. The side +// effects is minimized because this is a cc file not an h file. In fact, the +// WebAssembly module never calls the glob function, so it is better to split +// fileutil.cc into two files, and the WebAssembly module will only depend on +// the one without glob funcitons. +#ifndef GLOB_TILDE +#define GLOB_TILDE (1 << 12) +#endif + namespace htmlparser { std::string FileUtil::FileContents(std::string_view filepath) {