git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] fix: added new BANNED_EXPL macro for better error messages, new parameter

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 7, 2021, 20:34 UTC
Message-ID
<xmqq7dmi8zym.fsf@gitster.c.googlers.com>
In-Reply-To
<pull.896.git.1614991897210.gitgitgadget@gmail.com>
"HG King via GitGitGadget" <gitgitgadget@gmail.com> writes:
>  #undef strcpy
> -#define strcpy(x,y) BANNED(strcpy)
> +#define strcpy(x,y) BANNED_EXPL(strcpy, buffer_overflow_risk)

That does not help programmers that much (the above does not say what to use instead, for example), and the mechanism inherently does not give you sufficient space to give helpful guidance.

Adding a comment around each of these definition may be OK. Upon seeing foo_is_a_banned_function, somebody new to the codebase would look for where it is banned, and find the above, so that is a good place to give guidance.

Previous: HG King via GitGitGadgetNext: Taylor Blau
Message 2 of 5 in “fix: added new BANNED_EXPL macro for better error messages, new parameter”
  1. fix: added new BANNED_EXPL macro for better error messages, new parameterHG King via GitGitGadget, Mar 6, 2021
  2. Junio C HamanoMar 7, 2021
  3. Taylor BlauMar 8, 2021
  4. Jeff KingMar 8, 2021
  5. Junio C HamanoMar 8, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.