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 5EEB76EC57; Sat, 12 Jun 2021 01:01:26 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5EEB76EC57 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1623448886; bh=zPi4jsOE3Y0ELWdr2gb+S/CMX9j0KkPGrXAi/CdJ47w=; 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=yQyhDwDWEjMXaZYpz+nVY/kvefqUUNyrawfrKwW9W83B3DAzQv9BflchnOerw0RQu 0dvt5QncFrU2P2iJ3yg9W0CBwkg6b27c3YPVm0cKtOEBEaHRGg3PFZ1jcy0kD41+xK w55K1sqcQbCbtv18sDsVGB2lr71k/WKjC8Gj333k= Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [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 A20266EC57 for ; Sat, 12 Jun 2021 00:56:31 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A20266EC57 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1lrp8g-0008JK-TK; Sat, 12 Jun 2021 00:56:31 +0300 To: tarantool-patches@dev.tarantool.org, gorcunov@gmail.com, sergepetrenko@tarantool.org Date: Fri, 11 Jun 2021 23:56:13 +0200 Message-Id: <5249632265f6b61cf4db03a1771b53c57b299984.1623448465.git.v.shpilevoy@tarantool.org> 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: 4F1203BC0FB41BD9D5B0DA836B685C543EF5F9E25E4001B3518B676B8BE4A4C7182A05F53808504026CA438E84A1C7BD6DEB83C0029E370AD6CA43B06842BB73162EE363CFA95006 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7A8325FA649D0A450EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006375045C080FAAE96148638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8BAEC432B2056E3DBD3477DE3394B1EA5117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCF80095D1E57F4578A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD1828451B159A507268D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6B1CFA6D474D4A6A4089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C978317387390EF8EF1240BE75460A6CDB2857 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C8874A2D3FA5089FE51CEE2C4DA83A0046C90BF124A9BDB309C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EF31C0090ACECF247D699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34C6EC1BD9807109D2AB54D6FEFE934999D4887380A0154552BEEB91946D9C5A39B8F588CC7B47D2061D7E09C32AA3244CA20D134414FBF0BB1095E67226827CFF55E75C8D0ED9F6EEFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojQR1NM653rVELUlhRoZAuKg== X-Mailru-Sender: 689FA8AB762F73936BC43F508A063822D4521F2FB1719DC20774F63EF89A18E83841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: [Tarantool-patches] [PATCH 05/13] diag: introduce diag_set_detailed() 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" diag_set() uses the current file and line as built-in macros. In the future patches there are going to appear a couple of new diag_set-like helpers which also would want to preserve the original file and line. For that they must be macros at least partially, like diag_set(), and pass their own file and line. Because they are going not to be very trivial and won't be implemented in the header. The patch introduces diag_set_detailed() which allows to pass custom file and line. Needed for #6027 --- src/lib/core/diag.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/lib/core/diag.h b/src/lib/core/diag.h index b07eea838..fa85326ad 100644 --- a/src/lib/core/diag.h +++ b/src/lib/core/diag.h @@ -347,17 +347,20 @@ struct error * BuildSocketError(const char *file, unsigned line, const char *socketname, const char *format, ...); -#define diag_set(class, ...) do { \ +#define diag_set_detailed(file, line, class, ...) do { \ /* Preserve the original errno. */ \ int save_errno = errno; \ - say_debug("%s at %s:%i", #class, __FILE__, __LINE__); \ + say_debug("%s at %s:%i", #class, file, line); \ struct error *e; \ - e = Build##class(__FILE__, __LINE__, ##__VA_ARGS__); \ + e = Build##class(file, line, ##__VA_ARGS__); \ diag_set_error(diag_get(), e); \ /* Restore the errno which might have been reset. */ \ errno = save_errno; \ } while (0) +#define diag_set(...) \ + diag_set_detailed(__FILE__, __LINE__, __VA_ARGS__) + #define diag_add(class, ...) do { \ int save_errno = errno; \ say_debug("%s at %s:%i", #class, __FILE__, __LINE__); \ -- 2.24.3 (Apple Git-128)