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

Stephen Scalpone sscalpone at nvidia.com
Fri Nov 17 20:08:34 EST 2017

Flang’s clang, in particular ClangAttrEmitter.cpp, compiles fine for me with gcc 5.4.0 on x86 and 7.2.1. on ppc64le.  For clang, I’m on branch flang_release_50.

For flang itself, I’m compiling with the just-built clang without any warnings or errors.  I’ve also compiled flang with gcc 7.2.1 on ppc64le.

I hear what you are saying about the enumeration declaration.

- Steve

From: flang-dev [mailto:flang-dev-bounces at lists.flang-compiler.org] On Behalf Of Stefan Teleman
Sent: Thursday, November 16, 2017 6:41 AM
To: flang-dev <flang-dev at lists.flang-compiler.org>
Subject: [Flang-dev] flang's clang clone does not compile

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

/builds-1/steleman/llvm-git/20171115-flang/llvm-git/tools/clang/utils/TableGen/ClangAttrEmitter.cpp: In constructor ‘{anonymous}::EnumArgument::EnumArgument(const llvm::Record&, llvm::StringRef)’:
/builds-1/steleman/llvm-git/20171115-flang/llvm-git/tools/clang/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>)’

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



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)
     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<mailto:stefan.teleman at gmail.com>

This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.flang-compiler.org/pipermail/flang-dev_lists.flang-compiler.org/attachments/20171118/f9ab010d/attachment-0002.html>

More information about the flang-dev mailing list