[Flang-dev] flang's clang clone does not compile

Stefan Teleman stefan.teleman at gmail.com
Thu Nov 16 09:41:09 EST 2017


Git checkout of https://github.com/flang-compiler/clang as of 11/15/2017:

/builds-1/steleman/llvm-git/20171115-flang/llvm-git/tools/cl
ang/utils/TableGen/ClangAttrEmitter.cpp: In constructor
‘{anonymous}::EnumArgument::EnumArgument(const llvm::Record&,
llvm::StringRef)’:
/builds-1/steleman/llvm-git/20171115-flang/llvm-git/tools/cl
ang/utils/TableGen/ClangAttrEmitter.cpp:738:42: error: no matching function
for call to ‘std::vector<std::__cxx11::basic_string<char>
>::vector(std::vector<llvm::StringRef>)’
         uniques(uniqueEnumsInOrder(enums))
                                          ^

llvm::Record::getValueAsListOfStrings(StringRef FieldName) returns a
std::vector<llvm::StringRef>. This return type cannot be used to initialize
a std::vector<std::string>.

Also:

${top_srcdir}/tools/flang/include/flang/Error/pgerror.h:

The declaration

typedef enum error_code error_code_t;

is illegal in C99 and above.

Forward-declarations of enums are not allowed in C99 or higher.

Furthermore, in ${top_srcdir}/tools/flang/CMakeLists.txt, -Werror is set
for C compilation:

  option(WITH_WERROR "Compile with '-Werror' C compiler flag" ON)
  if (WITH_WERROR)
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
  endif ()


This guarantees that the enum forward declaration in pgerror.h above will
never compile.

The compilers used are: GCC 5.4.0 and GCC 7.2.0.

This is git checkout release_50 of flang's clang clone.

-- 
Stefan Teleman
stefan.teleman at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.flang-compiler.org/pipermail/flang-dev_lists.flang-compiler.org/attachments/20171116/b5214336/attachment-0002.html>


More information about the flang-dev mailing list