Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CMAKE_CXX_FLAGS for Intel compiler #465

Merged
merged 1 commit into from
Apr 27, 2016

Conversation

ds283
Copy link

@ds283 ds283 commented Apr 25, 2016

The current CMakeLists.txt can't be used with the Intel compiler, because it relies on setting the necessary -std=c++11 switch in a compiler detection block based on CMAKE_CXX_COMPILER_ID.

The Intel compiler accepts the same warnings options as gcc (see here--link for v.15 of the compiler which is less recent than the current v.16, but as far as I know nothing significant has changed here), so I have copied the same -W flags used for gcc.

The result compiles and builds correctly, although it gives a number of compatibility and portability warnings that I don't see when compiling with Apple Clang.

@cdunn2001
Copy link
Contributor

Would those warnings be fixable? Please post them.

@cdunn2001 cdunn2001 merged commit 4018422 into open-source-parsers:master Apr 27, 2016
@ds283 ds283 deleted the intel-compiler branch April 27, 2016 15:26
@ds283
Copy link
Author

ds283 commented Apr 27, 2016

Here's the result of compiling with icpc (ICC) 16.0.1 20151020.

[ 75%] Performing build step for 'jsoncpp'
Scanning dependencies of target jsoncpp_lib_static
[ 11%] Building CXX object src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_reader.cpp.o
In file included from /Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_reader.cpp(10):
/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_tool.h(66): warning #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
      *--current = static_cast<char>(value % 10U + static_cast<unsigned>('0'));
                   ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_reader.cpp(433): warning #2259: non-pointer conversion from "int" to "char" may lose significant bits
      c = (current_ = p) < end_ ? *p++ : 0;
        ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_reader.cpp(436): warning #2259: non-pointer conversion from "int" to "char" may lose significant bits
      c = (current_ = p) < end_ ? *p++ : 0;
        ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_reader.cpp(438): warning #2259: non-pointer conversion from "int" to "char" may lose significant bits
        c = (current_ = p) < end_ ? *p++ : 0;
          ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_reader.cpp(442): warning #2259: non-pointer conversion from "int" to "char" may lose significant bits
      c = (current_ = p) < end_ ? *p++ : 0;
        ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_reader.cpp(444): warning #2259: non-pointer conversion from "int" to "char" may lose significant bits
        c = (current_ = p) < end_ ? *p++ : 0;
          ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_reader.cpp(446): warning #2259: non-pointer conversion from "int" to "char" may lose significant bits
        c = (current_ = p) < end_ ? *p++ : 0;
          ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_reader.cpp(1397): warning #2259: non-pointer conversion from "int" to "char" may lose significant bits
      c = (current_ = p) < end_ ? *p++ : 0;
        ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_reader.cpp(1400): warning #2259: non-pointer conversion from "int" to "char" may lose significant bits
      c = (current_ = p) < end_ ? *p++ : 0;
        ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_reader.cpp(1402): warning #2259: non-pointer conversion from "int" to "char" may lose significant bits
        c = (current_ = p) < end_ ? *p++ : 0;
          ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_reader.cpp(1406): warning #2259: non-pointer conversion from "int" to "char" may lose significant bits
      c = (current_ = p) < end_ ? *p++ : 0;
        ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_reader.cpp(1408): warning #2259: non-pointer conversion from "int" to "char" may lose significant bits
        c = (current_ = p) < end_ ? *p++ : 0;
          ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_reader.cpp(1410): warning #2259: non-pointer conversion from "int" to "char" may lose significant bits
        c = (current_ = p) < end_ ? *p++ : 0;
          ^

remark #11074: Inlining inhibited by limit max-size 
remark #11074: Inlining inhibited by limit max-total-size 
remark #11076: To get full report use -qopt-report=4 -qopt-report-phase ipo
[ 22%] Building CXX object src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_value.cpp.o
/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_value.cpp(132): warning #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
      *length = static_cast<unsigned>(strlen(prefixed));
                ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_value.cpp(387): warning #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
    value_.string_ = duplicateAndPrefixStringValue(value, static_cast<unsigned>(strlen(value)));
                                                          ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_value.cpp(393): warning #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
        duplicateAndPrefixStringValue(beginValue, static_cast<unsigned>(endValue - beginValue));
                                                  ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_value.cpp(399): warning #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
        duplicateAndPrefixStringValue(value.data(), static_cast<unsigned>(value.length()));
                                                    ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_value.cpp(1025): warning #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
        key, static_cast<unsigned>(strlen(key)), CZString::noDuplication); // NOTE!
             ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_value.cpp(1045): warning #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
        key, static_cast<unsigned>(cend-key), CZString::duplicateOnCopy);
             ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_value.cpp(1069): warning #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
    CZString actualKey(key, static_cast<unsigned>(cend-key), CZString::noDuplication);
                            ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_value.cpp(1133): warning #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
    CZString actualKey(key, static_cast<unsigned>(cend-key), CZString::noDuplication);
                            ^

remark #11074: Inlining inhibited by limit max-size 
remark #11074: Inlining inhibited by limit max-total-size 
remark #11076: To get full report use -qopt-report=4 -qopt-report-phase ipo
[ 33%] Building CXX object src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_writer.cpp.o
In file included from /Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_writer.cpp(8):
/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_tool.h(66): warning #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
      *--current = static_cast<char>(value % 10U + static_cast<unsigned>('0'));
                   ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_writer.cpp(358): warning #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
      if (ok) document_ += valueToQuotedStringN(str, static_cast<unsigned>(end-str));
                                                     ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_writer.cpp(382): warning #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
        document_ += valueToQuotedStringN(name.data(), static_cast<unsigned>(name.length()));
                                                       ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_writer.cpp(428): warning #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
      if (ok) pushValue(valueToQuotedStringN(str, static_cast<unsigned>(end-str)));
                                                  ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_writer.cpp(529): warning #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
        lineLength += static_cast<ArrayIndex>(childValues_[index].length());
                      ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_writer.cpp(645): warning #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
      if (ok) pushValue(valueToQuotedStringN(str, static_cast<unsigned>(end-str)));
                                                  ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_writer.cpp(748): warning #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
        lineLength += static_cast<ArrayIndex>(childValues_[index].length());
                      ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_writer.cpp(926): warning #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
      if (ok) pushValue(valueToQuotedStringN(str, static_cast<unsigned>(end-str)));
                                                  ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_writer.cpp(948): warning #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
          writeWithIndent(valueToQuotedStringN(name.data(), static_cast<unsigned>(name.length())));
                                                            ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/lib_json/json_writer.cpp(1031): warning #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
        lineLength += static_cast<ArrayIndex>(childValues_[index].length());
                      ^

remark #11074: Inlining inhibited by limit max-size 
remark #11074: Inlining inhibited by limit max-total-size 
remark #11076: To get full report use -qopt-report=4 -qopt-report-phase ipo
[ 44%] Linking CXX static library libjsoncpp.a
[ 44%] Built target jsoncpp_lib_static
Scanning dependencies of target jsontestrunner_exe
[ 55%] Building CXX object src/jsontestrunner/CMakeFiles/jsontestrunner_exe.dir/main.cpp.o
/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/jsontestrunner/main.cpp(61): warning #191: type qualifier is meaningless on cast type
    unsigned long const usize = static_cast<unsigned long const>(size);
                                            ^

remark #11074: Inlining inhibited by limit max-size 
remark #11074: Inlining inhibited by limit max-total-size 
remark #11076: To get full report use -qopt-report=4 -qopt-report-phase ipo
[ 66%] Linking CXX executable jsontestrunner_exe
[ 66%] Built target jsontestrunner_exe
Scanning dependencies of target jsoncpp_test
[ 77%] Building CXX object src/test_lib_json/CMakeFiles/jsoncpp_test.dir/jsontest.cpp.o
/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/test_lib_json/jsontest.cpp(240): warning #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
    return static_cast<unsigned int>(tests_.size());
           ^

/Users/ds283/Documents/Code/CppTransport/CppTransport/build-icpc/thirdparty/jsoncpp/src/src/test_lib_json/jsontest.cpp(295): warning #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
        unsigned int failedCount = static_cast<unsigned int>(failures.size());
                                   ^

@cdunn2001 cdunn2001 self-assigned this May 3, 2016
@cdunn2001
Copy link
Contributor

cdunn2001 commented May 16, 2016

#474 fixes most of these, but the implicit integer conversions are tough. In all cases, the value definitely fits within the smaller integer, but I don't know how to tell the stupid compiler.

If this change turns out to be insufficient, just let us know. We will try to make warnings into errors only for our TravisCI tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants