Charusso marked an inline comment as done.
Charusso added inline comments.
================
Comment at: clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp:226
+ DiagnosticBuilder &Diag) {
+ if (getLangOpts().CPlusPlus11) {
+ StringRef NewFuncName = (Name[0] != 'w') ? "strncpy_s" : "wcsncpy_s";
----------------
aaron.ballman wrote:
> Charusso wrote:
> > aaron.ballman wrote:
> > > What about C?
> > The `else` part would fire.
> I think this comment got moved to an unrelated area. I was talking about
> `NotNullTerminatedResultCheck::memmoveFix()`, where there is no `else`
> clause. However, I'm also not entirely certain why you are assuming the _s
> versions of those functions are available in C++ (they're in Annex K for C,
> which is an optional annex).
The `else` clause is missing, according to the documentation:
> - ``memmove``, ``wmemmove``:
> - C11: New function is ``memmove_s``/``wmemmove_s``, it has four arguments,
> - the new second argument is the first argument's length, and
> - the third argument will be moved as the fourth, where ``+ 1`` needed.
>
> - Before C11: The third argument gets a ``+ 1`` operation.
So the third argument as a token remains third if I add an extra second
argument as a string, that's why it's work well on both options.
https://reviews.llvm.org/D45050
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits