- Notifications
You must be signed in to change notification settings - Fork 264
Closed
Labels
Description
Transpiling with cppfront and then compiling with gcc -Wold-style-cast I get the following warning:
cpp2util.h: In Konstruktor »cpp2::args_t::args_t(int, const char* const*)«: cpp2util.h:1420:58: Warnung: Verwendung einer Typumwandlung nach »size_t« {aka »long unsigned int«} im alten Stil [-Wold-style-cast] 1420 | args_t(int c, char const* const* v) : vector{(size_t)c}, argc{c}, argv{v} {} | ^ | --------- | static_cast (c) Replacing (size_t)c with static_cast<size_t>(c) in cpp2util.h:1420 removes the warning.
Compiling cppfront itself with gcc -Wold-style-cast gives some more warnings:
source/../include/cpp2util.h: In Konstruktor »cpp2::args_t::args_t(int, const char* const*)«: source/../include/cpp2util.h:1420:58: Warnung: Verwendung einer Typumwandlung nach »size_t« {aka »long unsigned int«} im alten Stil [-Wold-style-cast] 1420 | args_t(int c, char const* const* v) : vector{(size_t)c}, argc{c}, argv{v} {} | ^ | --------- | static_cast (c) source/common.h: In Funktion »char cpp2::to_upper(char)«: source/common.h:327:58: Warnung: Verwendung einer Typumwandlung nach »char« im alten Stil [-Wold-style-cast] 327 | if (0 <= c && c <= 126) { return (char)std::toupper(c); } | ^ | ------ | static_cast ( ) source/lex.h: In Elementfunktion »cpp2::token::operator std::string_view() const«: source/lex.h:249:34: Warnung: Verwendung einer Typumwandlung nach »unsigned int« im alten Stil [-Wold-style-cast] 249 | return {start, (unsigned)count}; | ^~~~~ | --------------- | static_cast (count) source/lex.h: In Elementfunktion »std::string cpp2::token::to_string(bool) const«: source/lex.h:267:50: Warnung: Verwendung einer Typumwandlung nach »unsigned int« im alten Stil [-Wold-style-cast] 267 | auto text = std::string{start, (unsigned)count}; | ^~~~~ | --------------- | static_cast (count) source/lex.h: In Lambda-Funktion: source/lex.h:861:43: Warnung: Verwendung einer Typumwandlung nach »int« im alten Stil [-Wold-style-cast] 861 | return (int)(m[0].length()); | ^ | ----- | static_cast ( ) source/cppfront.cpp: In Elementfunktion »void cpp2::cppfront::emit(const cpp2::binary_expression_node&)«: source/cppfront.cpp:3068:53: Warnung: Verwendung einer Typumwandlung nach »using string_view = class std::basic_string_view« {aka »class std::basic_string_view«} im alten Stil [-Wold-style-cast] 3068 | || is_digit(((std::string_view)*rhs_tok)[0]) | ^~~~~~~ source/cppfront.cpp: In Elementfunktion »void cpp2::cppfront::emit(const cpp2::declaration_node&, const std::string&)«: source/cppfront.cpp:4589:58: Warnung: Verwendung einer Typumwandlung nach »using string_view = class std::basic_string_view« {aka »class std::basic_string_view«} im alten Stil [-Wold-style-cast] 4589 | loc += ((std::string_view)*decl.name()); | ^ | - | static_cast< - | > ( )