From: "HG King via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: HG King <hgmaxwellking@gmail.com>, HGimself <hgmaxwellking@gmail.com>
Subject: [PATCH] fix: added new BANNED_EXPL macro for better error messages, new parameter
Date: Sat, 06 Mar 2021 00:51:36 +0000 [thread overview]
Message-ID: <pull.896.git.1614991897210.gitgitgadget@gmail.com> (raw)
From: HGimself <hgmaxwellking@gmail.com>
Signed-off-by: HGimself <hgmaxwellking@gmail.com>
---
fix: added new BANNED_EXPL macro for better error messages, has a par…
Extend Banned Function Error Messages
=====================================
AS A NEWER USER, I WANT TO BE ABLE TO UNDERSTAND WHY CERTAIN FUNCTIONS
ARE BANNED AS WELL AS KNOW WHAT FUNCTIONS TO USE INSTEAD.
Changes
=======
* Added new macro named BANNED_EXPL(func, expl) which added the expl
onto the error message
* Used strcpy as an example
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-896%2FHGHimself%2Ffix%2Fadd-new-ban-macro-with-explanation-parameter-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-896/HGHimself/fix/add-new-ban-macro-with-explanation-parameter-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/896
banned.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/banned.h b/banned.h
index 7ab4f2e49219..a19f0afeda79 100644
--- a/banned.h
+++ b/banned.h
@@ -9,9 +9,10 @@
*/
#define BANNED(func) sorry_##func##_is_a_banned_function
+#define BANNED_EXPL(func, expl) sorry_##func##_is_a_banned_funcion_because_##expl##.
#undef strcpy
-#define strcpy(x,y) BANNED(strcpy)
+#define strcpy(x,y) BANNED_EXPL(strcpy, buffer_overflow_risk)
#undef strcat
#define strcat(x,y) BANNED(strcat)
#undef strncpy
base-commit: be7935ed8bff19f481b033d0d242c5d5f239ed50
--
gitgitgadget
next reply other threads:[~2021-03-06 0:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-06 0:51 HG King via GitGitGadget [this message]
2021-03-07 20:34 ` [PATCH] fix: added new BANNED_EXPL macro for better error messages, new parameter Junio C Hamano
2021-03-08 18:05 ` Taylor Blau
2021-03-08 18:30 ` Jeff King
2021-03-08 18:41 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=pull.896.git.1614991897210.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=hgmaxwellking@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).