On 2019/10/12 7:30, Kim Barrett wrote:
On Oct 11, 2019, at 3:29 PM, Chris Plummer <chris.plum...@oracle.com> wrote:
Second, can the macros be used just before and after the strncpy reference 
rather than around the whole function? It would clarify both that the strncpy 
use has these macros in place and that the macros are there for the strncpy. As 
it stands now, if you see the macro references it won't be readily obvious why 
they are there.

+1, unless there’s some reason that doesn’t work.

The scoping rules for pragmas are not standardized (because pragmas aren’t), 
and the gcc documentation is rather thin.

I recently saw similar issue in HeapStats [1] as below:

```
logManager.cpp:1439: error: #pragma GCC diagnostic not allowed inside functions
```

Thus I set #pragma around the function.
CentOS 6 which issue is seen has GCC 4.4.7, but this issue is gone on CentOS 7 
which has GCC 4.8.5 .
So I will set #pragma around strncpy() instead of around the function.


Yasumasa


[1] https://github.com/HeapStats/heapstats/pull/149

Reply via email to