[libcxx-commits] [PATCH] D108630: [libc++] Remove _LIBCPP_HAS_NO_LONG_LONG in favour of using_if_exists

Dimitry Andric via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Sep 2 02:48:59 PDT 2021


dim added a comment.

Hmm I have applied this on top of our existing libc++ headers, but if I compile a simple program using e.g. `-std=c++98` I immediately get errors due to missing declarations:

  % cat helloworld.cpp
  #include <iostream>
  
  int main(void)
  {
    std::cout << "Hello World!" << std::endl;
    return 0;
  }
  
  % clang++ -std=c++98 -c helloworld.cpp
  In file included from helloworld.cpp:1:
  In file included from /usr/include/c++/v1/iostream:37:
  In file included from /usr/include/c++/v1/ios:215:
  In file included from /usr/include/c++/v1/__locale:15:
  In file included from /usr/include/c++/v1/string:511:
  In file included from /usr/include/c++/v1/string_view:179:
  In file included from /usr/include/c++/v1/__string:57:
  In file included from /usr/include/c++/v1/algorithm:653:
  In file included from /usr/include/c++/v1/memory:670:
  In file included from /usr/include/c++/v1/typeinfo:61:
  In file included from /usr/include/c++/v1/exception:83:
  /usr/include/c++/v1/cstdlib:102:9: error: no member named 'lldiv_t' in the global namespace; did you mean 'ldiv_t'?
  using ::lldiv_t _LIBCPP_USING_IF_EXISTS;
        ~~^
  /usr/include/stdlib.h:71:3: note: 'ldiv_t' declared here
  } ldiv_t;
    ^
  In file included from helloworld.cpp:1:
  In file included from /usr/include/c++/v1/iostream:37:
  In file included from /usr/include/c++/v1/ios:215:
  In file included from /usr/include/c++/v1/__locale:15:
  In file included from /usr/include/c++/v1/string:511:
  In file included from /usr/include/c++/v1/string_view:179:
  In file included from /usr/include/c++/v1/__string:57:
  In file included from /usr/include/c++/v1/algorithm:653:
  In file included from /usr/include/c++/v1/memory:670:
  In file included from /usr/include/c++/v1/typeinfo:61:
  In file included from /usr/include/c++/v1/exception:83:
  /usr/include/c++/v1/cstdlib:106:9: error: no member named 'atoll' in the global namespace; did you mean 'atol'?
  using ::atoll _LIBCPP_USING_IF_EXISTS;
        ~~^
  /usr/include/stdlib.h:95:7: note: 'atol' declared here
  long     atol(const char *);
           ^
  In file included from helloworld.cpp:1:
  In file included from /usr/include/c++/v1/iostream:37:
  In file included from /usr/include/c++/v1/ios:215:
  In file included from /usr/include/c++/v1/__locale:15:
  In file included from /usr/include/c++/v1/string:511:
  In file included from /usr/include/c++/v1/string_view:179:
  In file included from /usr/include/c++/v1/__string:57:
  In file included from /usr/include/c++/v1/algorithm:653:
  In file included from /usr/include/c++/v1/memory:670:
  In file included from /usr/include/c++/v1/typeinfo:61:
  In file included from /usr/include/c++/v1/exception:83:
  /usr/include/c++/v1/cstdlib:111:9: error: no member named 'strtoll' in the global namespace
  using ::strtoll _LIBCPP_USING_IF_EXISTS;
        ~~^
  /usr/include/c++/v1/cstdlib:113:9: error: no member named 'strtoull' in the global namespace; did you mean 'strtoul'?
  using ::strtoull _LIBCPP_USING_IF_EXISTS;
        ~~^
  /usr/include/stdlib.h:121:3: note: 'strtoul' declared here
           strtoul(const char * __restrict, char ** __restrict, int);
           ^
  In file included from helloworld.cpp:1:
  In file included from /usr/include/c++/v1/iostream:37:
  In file included from /usr/include/c++/v1/ios:215:
  In file included from /usr/include/c++/v1/__locale:15:
  In file included from /usr/include/c++/v1/string:511:
  In file included from /usr/include/c++/v1/string_view:179:
  In file included from /usr/include/c++/v1/__string:57:
  In file included from /usr/include/c++/v1/algorithm:653:
  In file included from /usr/include/c++/v1/memory:670:
  In file included from /usr/include/c++/v1/typeinfo:61:
  In file included from /usr/include/c++/v1/exception:83:
  /usr/include/c++/v1/cstdlib:132:9: error: no member named 'llabs' in the global namespace; did you mean 'labs'?
  using ::llabs _LIBCPP_USING_IF_EXISTS;
        ~~^
  /usr/include/stdlib.h:104:7: note: 'labs' declared here
  long     labs(long) __pure2;
           ^
  In file included from helloworld.cpp:1:
  In file included from /usr/include/c++/v1/iostream:37:
  In file included from /usr/include/c++/v1/ios:215:
  In file included from /usr/include/c++/v1/__locale:15:
  In file included from /usr/include/c++/v1/string:511:
  In file included from /usr/include/c++/v1/string_view:179:
  In file included from /usr/include/c++/v1/__string:57:
  In file included from /usr/include/c++/v1/algorithm:653:
  In file included from /usr/include/c++/v1/memory:670:
  In file included from /usr/include/c++/v1/typeinfo:61:
  In file included from /usr/include/c++/v1/exception:83:
  /usr/include/c++/v1/cstdlib:135:9: error: no member named 'lldiv' in the global namespace; did you mean 'ldiv'?
  using ::lldiv _LIBCPP_USING_IF_EXISTS;
        ~~^
  /usr/include/stdlib.h:105:9: note: 'ldiv' declared here
  ldiv_t   ldiv(long, long) __pure2;
           ^
  In file included from helloworld.cpp:1:
  In file included from /usr/include/c++/v1/iostream:37:
  In file included from /usr/include/c++/v1/ios:215:
  In file included from /usr/include/c++/v1/__locale:15:
  In file included from /usr/include/c++/v1/string:511:
  In file included from /usr/include/c++/v1/string_view:179:
  In file included from /usr/include/c++/v1/__string:60:
  /usr/include/c++/v1/cwchar:140:9: error: no member named 'wcstoll' in the global namespace
  using ::wcstoll _LIBCPP_USING_IF_EXISTS;
        ~~^
  /usr/include/c++/v1/cwchar:142:9: error: no member named 'wcstoull' in the global namespace; did you mean 'wcstoul'?
  using ::wcstoull _LIBCPP_USING_IF_EXISTS;
        ~~^
  /usr/include/wchar.h:170:3: note: 'wcstoul' declared here
           wcstoul(const wchar_t * __restrict, wchar_t ** __restrict, int);
           ^
  8 errors generated.

But I think this is because my current clang is still 12.0.1? Was `using_if_exists` only added after 13.0.0 ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108630/new/

https://reviews.llvm.org/D108630



More information about the libcxx-commits mailing list