From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 13B176E1C9; Sat, 6 Nov 2021 02:57:15 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 13B176E1C9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1636156635; bh=pqqm64jCJlQCkgWnWMeXUTooxi8lLAqDh6csuZ6Cs6c=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=kzcxKaUGUbKtyvq4v+oP9LM8PZUFSUzkOxN0v0IMZLg+UqOwNhlFKAp3p7MQXV33I Iae7htbBGO11tshJxE6IbmHLi9ThX4C+qPeCnUs4lTS49NSC3y1u+MdGSgOvfGYqny SImjae4SdHJ80R/H4LzKLr0Oq62zPRRR+nACB4nI= Received: from smtpng3.i.mail.ru (smtpng3.i.mail.ru [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 9660D6E1C9 for ; Sat, 6 Nov 2021 02:56:43 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 9660D6E1C9 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1mj94c-0006s6-N9; Sat, 06 Nov 2021 02:56:43 +0300 To: tarantool-patches@dev.tarantool.org, sergepetrenko@tarantool.org, vdavydov@tarantool.org Date: Sat, 6 Nov 2021 00:56:32 +0100 Message-Id: X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9F9D976862A30D4FE24BA5635EEB592969D7326BCF5538DC0182A05F5380850406590807DD8DC9975AE8065BF42BC06176356694306DE5E82BDD7F880D75098B4 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7F9D3BE5B596754B8C2099A533E45F2D0395957E7521B51C2CFCAF695D4D8E9FCEA1F7E6F0F101C6778DA827A17800CE7ECD3FEFFF0C7120D8F08D7030A58E5AD1A62830130A00468AEEEE3FBA3A834EE7353EFBB553375667E8FD95C1B0C506B50D6B640295CC82E466E84966D2940E8A471835C12D1D9774AD6D5ED66289B5278DA827A17800CE71AE4D56B06699BBC9FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C317B107DEF921CE79117882F4460429728AD0CFFFB425014E868A13BD56FB6657E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F79006377AA2284B41911753EFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A213B5FB47DCBC3458834459D11680B505F04FA6A337665710020D5B004101EB48 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C7E8FD95C1B0C506B50D6B640295CC82E466E84966D2940E89C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EFFA31AF570DAA8E08699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34C02783DDD5A45DEFCB770EDC3B19917856682BD6B15E2DE8BEAB634359AF54231372833CC39A11431D7E09C32AA3244C12CE64A49BE32B8AC2ED7667A330FCC15595C85A795C7BAEFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj75A/c671lqVsPa0rpI91dw== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D4C03675D047579052374CCE42538A3863841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: [Tarantool-patches] [PATCH 1/9] diag: return created error from diag_set() X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" And from diag_add(). This will be helpful not to bother with box_error_last() and diag_last_error(diag_get()) in the future patch. It will change some attributes of a just created ER_READONLY error to add more details. Part of #5568 --- src/lib/core/diag.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lib/core/diag.h b/src/lib/core/diag.h index fa85326ad..d7d09f6fb 100644 --- a/src/lib/core/diag.h +++ b/src/lib/core/diag.h @@ -347,7 +347,7 @@ struct error * BuildSocketError(const char *file, unsigned line, const char *socketname, const char *format, ...); -#define diag_set_detailed(file, line, class, ...) do { \ +#define diag_set_detailed(file, line, class, ...) ({ \ /* Preserve the original errno. */ \ int save_errno = errno; \ say_debug("%s at %s:%i", #class, file, line); \ @@ -356,19 +356,21 @@ BuildSocketError(const char *file, unsigned line, const char *socketname, diag_set_error(diag_get(), e); \ /* Restore the errno which might have been reset. */ \ errno = save_errno; \ -} while (0) + e; \ +}) #define diag_set(...) \ diag_set_detailed(__FILE__, __LINE__, __VA_ARGS__) -#define diag_add(class, ...) do { \ +#define diag_add(class, ...) ({ \ int save_errno = errno; \ say_debug("%s at %s:%i", #class, __FILE__, __LINE__); \ struct error *e; \ e = Build##class(__FILE__, __LINE__, ##__VA_ARGS__); \ diag_add_error(diag_get(), e); \ errno = save_errno; \ -} while (0) + e; \ +}) #if defined(__cplusplus) } /* extern "C" */ -- 2.24.3 (Apple Git-128)