From patchwork Fri Nov 17 16:52:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 839065 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-467174-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="KS935paW"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ydkhJ27gbz9s74 for ; Sat, 18 Nov 2017 03:53:20 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=EDOHEh680kbtHvlNKRpztySjTpAVQfT6snr/TQmlKOVazJEG06 xxEgo7mUbhxHGAZucEFXn093ZcdCx+Y1YVWPdgcU2C5dKMwj86rqcM+HiBa5RRDr kW8FzNgvVaVZkxyncmDWs7XtN8p8r8+STCXhJdHlcXlXq+o21GlHbjOeA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=KYoTvQO+L3PiazN8+1azgP5L0DM=; b=KS935paWrNu8FMcJShY/ LVSJDav2D/cUfhL2FUyUH/Cp/fIjnqOZhIYXDusEtBeScBkDwx3odWvsj6zcZo6f iTqY1XAADcEsjIfyIhCv4Q6zoN6Bl2DZso8bl2slJYNYuii2dyEiMnBgltKtmXb6 ZH0vNsFDcDY1xNXmsyMYNSE= Received: (qmail 61155 invoked by alias); 17 Nov 2017 16:53:05 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 60961 invoked by uid 89); 17 Nov 2017 16:53:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.7 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, KB_WAM_FROM_NAME_SINGLEWORD, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-yb0-f181.google.com Received: from mail-yb0-f181.google.com (HELO mail-yb0-f181.google.com) (209.85.213.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 17 Nov 2017 16:53:02 +0000 Received: by mail-yb0-f181.google.com with SMTP id s65so971163ybb.10 for ; Fri, 17 Nov 2017 08:53:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:to:cc:from:subject:message-id:date :user-agent:mime-version:content-language; bh=LackcAnNlYyMEwsITOD0PtBaG8PUewUf+P7Uz1VC9hA=; b=hSBsiK7hu9p8BYgu2WNSzF6XVjLEHT9UOevF92NV1Ng2XQf6/V22zMuYNVglKR7i5L hqej+Munr1V6z5UethPERTYNfOgSms0OUwpUVUaV+8//gGTi63LexNTJXnHDrdHVS4cl hxV2PZWgxnaWOZIblmUQbY+eNBeOE6BoR5849u9NIBMBtfKgDspLMOEaCUjb4Jb7+sxt WUjEsrYz629jCAOhwXWQLwHQFj3JAAx7DJbO0YzqGCKnIs1I6K3qxyGopRuKFEYsD3TD knrMJyzZqCAYtm5h/94QEA31p76yepwYO73zihms3Oy9eG+JZBkc/l/j5oFl3H5PnF4k mHRg== X-Gm-Message-State: AJaThX56zM7iaOE6Bgusbk3W3GBSGEUkbn5KrSEdqHdGBlHuHbY+M/bM icw4pNyhGhCJQD0Jvyl2eh4= X-Google-Smtp-Source: AGs4zMY8/NHn3wdp/gyYcCWexNNdG7PeA7JPZIcCijVTab91o63THgu23E/LgwhcUed4H9XnM4LaNQ== X-Received: by 10.37.201.5 with SMTP id z5mr3596473ybf.297.1510937580552; Fri, 17 Nov 2017 08:53:00 -0800 (PST) Received: from ?IPv6:2620:10d:c0a3:20fb:7500:e7fb:4a6f:2254? ([2620:10d:c091:200::7f1f]) by smtp.googlemail.com with ESMTPSA id c11sm1653713ywb.106.2017.11.17.08.52.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:52:59 -0800 (PST) To: GCC Patches Cc: Jason Merrill From: Nathan Sidwell Subject: [PR c++/82836] Fixe testcase Message-ID: <6e4b7c0a-6dc8-2958-7c92-d7304902113f@acm.org> Date: Fri, 17 Nov 2017 11:52:57 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 The 82836 testcase fell out of creduce. In c++17 mode it fails horribly with missing return errors. Applying this fix, so it's valid in c++17. It still ICEs (in both 14 and 17 modes) with the 82836 fix removed. nathan 2017-11-17 Nathan Sidwell * g++.dg/pr82836.C: Fix for c++17. Index: g++.dg/pr82836.C ================================================================== --- g++.dg/pr82836.C (revision 254867) +++ g++.dg/pr82836.C (working copy) @@ -8,9 +8,9 @@ namespace std { typedef long unsigned size_t; inline namespace __cxx11 {} -double abs() {} -__int128 abs(__int128 ) {} -__float128 abs(__float128 ) {} + double abs() {return 0;} + __int128 abs(__int128 ) {return 0;} + __float128 abs(__float128 ) {return 0;} #pragma weak pthread_create @@ -82,37 +82,37 @@ namespace std { typedef char char_type; typedef int int_type; void assign() {} - bool eq() {} - bool lt() {} - int compare() {} - size_t length() {} - char_type find() {} - char_type move() {} - char_type copy() {} - char_type assign(char_type ) {} - char_type to_char_type() {} - int_type to_int_type() {} - bool eq_int_type() {} - int_type eof() {} - int_type not_eof() {} + bool eq() {return 0;} + bool lt() {return 0;} + int compare() {return 0;} + size_t length() {return 0;} + char_type find() {return 0;} + char_type move() {return 0;} + char_type copy() {return 0;} + char_type assign(char_type ) {return 0;} + char_type to_char_type() {return 0;} + int_type to_int_type() {return 0;} + bool eq_int_type() {return 0;} + int_type eof() {return 0;} + int_type not_eof() {return 0;} }; template <> struct char_traits< wchar_t > { typedef wchar_t char_type; typedef int int_type; void assign() {} - bool eq() {} - bool lt() {} - int compare() {} - size_t length() {} - char_type find() {} - char_type move() {} - char_type copy() {} - char_type assign(char_type ) {} - char_type to_char_type() {} - int_type to_int_type() {} - bool eq_int_type() {} - int_type eof() {} - int_type not_eof() {} + bool eq() {return 0;} + bool lt() {return 0;} + int compare() {return 0;} + size_t length() {return 0;} + char_type find() {return 0;} + char_type move() {return 0;} + char_type copy() {return 0;} + char_type assign(char_type ) {return 0;} + char_type to_char_type() {return 0;} + int_type to_int_type() {return 0;} + bool eq_int_type() {return 0;} + int_type eof() {return 0;} + int_type not_eof() {return 0;} }; } typedef int uint_least16_t; @@ -122,41 +122,41 @@ template <> struct char_traits< char16_t typedef char16_t char_type; typedef uint_least16_t int_type; void assign() {} - bool eq() {} - bool lt() {} - int compare() {} - size_t length() {} - char_type find() {} - char_type move() {} - char_type copy() {} - char_type assign(char_type ) {} - char_type to_char_type() {} - int_type to_int_type() {} - bool eq_int_type() {} - int_type eof() {} - int_type not_eof() {} + bool eq() {return false;} + bool lt() {return false;} + int compare() {return 0;} + size_t length() {return 0;} + char_type find() {return 0;} + char_type move() {return 0;} + char_type copy() {return 0;} + char_type assign(char_type ) {return 0;} + char_type to_char_type() {return 0;} + int_type to_int_type() {return 0;} + bool eq_int_type() {return false;} + int_type eof() {return 0;} + int_type not_eof() {return 0;} }; template <> struct char_traits< char32_t > { typedef char32_t char_type; typedef uint_least32_t int_type; void assign() {} - bool eq() {} - bool lt() {} - int compare() {} - size_t length() {} - char_type find() {} - char_type move() {} - char_type copy() {} - char_type assign(char_type ) {} - char_type to_char_type() {} - int_type to_int_type() {} - bool eq_int_type() {} - int_type eof() {} - int_type not_eof() {} + bool eq() {return false;} + bool lt() {return false;} + int compare() {return 0;} + size_t length() {return 0;} + char_type find() {return 0;} + char_type move() {return 0;} + char_type copy() {return 0;} + char_type assign(char_type ) {return 0;} + char_type to_char_type() {return 0;} + int_type to_int_type() {return 0;} + bool eq_int_type() {return false;} + int_type eof() {return 0;} + int_type not_eof() {return 0;} }; } -void *operator new(std::size_t) {} -void *operator new[](std::size_t) {} +void *operator new(std::size_t) {return (void *)1;} +void *operator new[](std::size_t) {return (void *)1;} void operator delete(void *){} void operator delete[](void *) {} namespace { @@ -173,7 +173,7 @@ public: ; template < typename _Tp > struct less { - bool operator()( _Tp , _Tp ) {} + bool operator()( _Tp , _Tp ) {return false;} }; } typedef int _Atomic_word; @@ -225,6 +225,7 @@ namespace std { (__gnu_cxx::__numeric_traits< int >::__min) ; + return 0; } }; } @@ -252,10 +253,10 @@ namespace std { void operator0() {} }; template <> struct __hash_base< size_t, char16_t > { - size_t operator0() {} + size_t operator0() {return 0;} }; template <> struct __hash_base< size_t, char32_t > { - size_t operator0() {} + size_t operator0() {return 0;} }; template <> struct hash< short > { void operator0() {} @@ -292,11 +293,11 @@ namespace std { ; _Bit_type _M_mask; _Bit_reference () {} - operator bool() {} + operator bool() {return false;} _Bit_reference (bool ) {} - _Bit_reference operator=(_Bit_reference ) {} - bool operator==(_Bit_reference ) {} - bool operator<(_Bit_reference ) {} + _Bit_reference operator=(_Bit_reference ) {return *this;} + bool operator==(_Bit_reference ) {return false;} + bool operator<(_Bit_reference ) {return false;} void flip() {} }; void swap() {} @@ -311,21 +312,21 @@ namespace std { void _M_bump_up() {} void _M_bump_down() {} void _M_incr() {} - bool operator==(_Bit_iterator_base ) {} - bool operator<(_Bit_iterator_base ) {} - bool operator!=(_Bit_iterator_base ) {} - bool operator>(_Bit_iterator_base ) {} - bool operator<=(_Bit_iterator_base ) {} - bool operator>=(_Bit_iterator_base ) {} + bool operator==(_Bit_iterator_base ) {return false;} + bool operator<(_Bit_iterator_base ) {return false;} + bool operator!=(_Bit_iterator_base ) {return false;} + bool operator>(_Bit_iterator_base ) {return false;} + bool operator<=(_Bit_iterator_base ) {return false;} + bool operator>=(_Bit_iterator_base ) {return false;} }; struct _Bit_iterator : _Bit_iterator_base { _Bit_iterator() : _Bit_iterator_base(0, 0) {} _Bit_iterator(_Bit_type *__x, int __y) : _Bit_iterator_base(__x, __y) {} - iterator _M_const_cast() {} - iterator operator+() {} - iterator operator-() {} - reference operator[](difference_type ) {} + iterator _M_const_cast() {return iterator ();} + iterator operator+() {return iterator ();} + iterator operator-() {return iterator ();} + reference operator[](difference_type ) {return 0;} }; void operator+(_Bit_iterator ) {} struct _Bit_const_iterator : _Bit_iterator_base { @@ -349,9 +350,10 @@ namespace std { class error_category { bool operator<(error_category __other) { less< error_category * >()(this, &__other); + return false; } - bool operator==(error_category ) {} - bool operator!=(error_category ) {} + bool operator==(error_category ) {return false;} + bool operator!=(error_category ) {return false;} }; } struct error_code { @@ -359,42 +361,42 @@ namespace std { error_code(error_category ) : _M_cat() {} void assign() {} void clear() {} - int value() {} - error_category category() {} - string message() {} + int value() {return 0;} + error_category category() {return error_category ();} + string message() {return string();} error_category _M_cat; }; - inline error_code make_error_code() noexcept {} + inline error_code make_error_code() noexcept {return error_code ();} inline bool operator<(const error_code , - const error_code ) noexcept {} + const error_code ) noexcept {return false;} struct error_condition { error_condition() {} error_condition(const error_category ) {} void assign() noexcept {} void clear() noexcept {} - int value() {} - const error_category &category() {} + int value() {return 0;} + const error_category category() {return error_category ();} string message_M_cat; }; - inline error_condition make_error_condition() noexcept {} + inline error_condition make_error_condition() noexcept {return error_condition ();} inline bool operator<(const error_condition , - const error_condition ) noexcept {} + const error_condition ) noexcept {return false;} inline bool operator==(const error_code , - const error_code ) noexcept {} + const error_code ) noexcept {return false;} inline bool operator==(const error_code , - const error_condition ) noexcept {} + const error_condition ) noexcept {return false;} inline bool operator==(const error_condition , - const error_code ) noexcept {} + const error_code ) noexcept {return false;} inline bool operator==(const error_condition , - const error_condition ) noexcept {} + const error_condition ) noexcept {return false;} inline bool operator!=(const error_code , - const error_code ) noexcept {} + const error_code ) noexcept {return false;} inline bool operator!=(const error_code , - const error_condition ) noexcept {} + const error_condition ) noexcept {return false;} inline bool operator!=(const error_condition , - const error_code ) noexcept {} + const error_code ) noexcept {return false;} inline bool operator!=(const error_condition , - const error_condition ) noexcept {} + const error_condition ) noexcept {return false;} class system_error : public runtime_error { error_code _M_code; @@ -410,47 +412,47 @@ namespace std { : runtime_error(error_code().message()) {} system_error(const string &__what) : runtime_error(error_code().message()) {} - const error_code &code() {} + const error_code code() {return error_code ();} void operator0() {} }; enum _Ios_Fmtflags {}; - _Ios_Fmtflags operator&(_Ios_Fmtflags __a__b) {} - _Ios_Fmtflags operator|(_Ios_Fmtflags __a, - _Ios_Fmtflags __b) {} - _Ios_Fmtflags operator^(_Ios_Fmtflags __a, - _Ios_Fmtflags __b) {} - _Ios_Fmtflags operator~(_Ios_Fmtflags __a) {} - _Ios_Fmtflags &operator|=(_Ios_Fmtflags , - _Ios_Fmtflags __b) {} - _Ios_Fmtflags &operator&=(_Ios_Fmtflags , - _Ios_Fmtflags __b) {} - _Ios_Fmtflags &operator^=(_Ios_Fmtflags , - _Ios_Fmtflags __b) {} + _Ios_Fmtflags operator&(_Ios_Fmtflags &__a) {return __a;} + _Ios_Fmtflags operator|(_Ios_Fmtflags &__a, + _Ios_Fmtflags __b) {return __a;} + _Ios_Fmtflags operator^(_Ios_Fmtflags &__a, + _Ios_Fmtflags __b) {return __a;} + _Ios_Fmtflags operator~(_Ios_Fmtflags &__a) {return __a;} + _Ios_Fmtflags &operator|=(_Ios_Fmtflags &__a, + _Ios_Fmtflags __b) {return __a;} + _Ios_Fmtflags &operator&=(_Ios_Fmtflags &__a, + _Ios_Fmtflags __b) {return __a;} + _Ios_Fmtflags &operator^=(_Ios_Fmtflags &__a, + _Ios_Fmtflags __b) {return __a;} enum _Ios_Openmode { _S_ios_openmode_max }; - _Ios_Openmode operator&(_Ios_Openmode __a__b) {} - _Ios_Openmode operator|(_Ios_Openmode __a, - _Ios_Openmode __b) {} - _Ios_Openmode operator^(_Ios_Openmode __a, - _Ios_Openmode __b) {} - _Ios_Openmode operator~(_Ios_Openmode __a) {} - _Ios_Openmode &operator|=(_Ios_Openmode , - _Ios_Openmode __b) {} - _Ios_Openmode &operator&=(_Ios_Openmode , - _Ios_Openmode __b) {} - _Ios_Openmode &operator^=(_Ios_Openmode , - _Ios_Openmode __b) {} + _Ios_Openmode operator&(_Ios_Openmode &__a__b) {return __a__b;} + _Ios_Openmode operator|(_Ios_Openmode &__a, + _Ios_Openmode __b) {return __a;} + _Ios_Openmode operator^(_Ios_Openmode &__a, + _Ios_Openmode __b) {return __a;} + _Ios_Openmode operator~(_Ios_Openmode &__a) {return __a;} + _Ios_Openmode &operator|=(_Ios_Openmode &__a, + _Ios_Openmode __b) {return __a;} + _Ios_Openmode &operator&=(_Ios_Openmode &__a, + _Ios_Openmode __b) {return __a;} + _Ios_Openmode &operator^=(_Ios_Openmode &__a, + _Ios_Openmode __b) {return __a;} enum _Ios_Iostate { _S_ios_iostate_max }; - _Ios_Iostate operator&(_Ios_Iostate __a__b) {} - _Ios_Iostate operator|(_Ios_Iostate __a, _Ios_Iostate __b) {} - _Ios_Iostate operator^(_Ios_Iostate __a, _Ios_Iostate __b) {} - _Ios_Iostate operator~(_Ios_Iostate __a) {} - _Ios_Iostate &operator|=(_Ios_Iostate , _Ios_Iostate __b) {} - _Ios_Iostate &operator&=(_Ios_Iostate , _Ios_Iostate __b) {} - _Ios_Iostate &operator^=(_Ios_Iostate , _Ios_Iostate __b) {} + _Ios_Iostate operator&(_Ios_Iostate &__a__b) {return __a__b;} + _Ios_Iostate operator|(_Ios_Iostate &__a, _Ios_Iostate __b) {return __a;} + _Ios_Iostate operator^(_Ios_Iostate &__a, _Ios_Iostate __b) {return __a;} + _Ios_Iostate operator~(_Ios_Iostate &__a) {return __a;} + _Ios_Iostate &operator|=(_Ios_Iostate &__a, _Ios_Iostate __b) {return __a;} + _Ios_Iostate &operator&=(_Ios_Iostate &__a, _Ios_Iostate __b) {return __a;} + _Ios_Iostate &operator^=(_Ios_Iostate &__a, _Ios_Iostate __b) {return __a;} enum class io_errc; - inline error_code make_error_code(io_errc __e) noexcept {} + inline error_code make_error_code(io_errc __e) noexcept {return error_code();} inline error_condition make_error_condition_wrap_class_string; static luaL_Reg swig_ClientProfile_methods; static luaL_Reg swig_ClientProfile_meta;