Paul Eggert wrote:
> > msvc14/usr/include/WDBGEXTS.H:#define dprintf
> > (ExtensionApis.lpOutputRoutine)
> > minix-3.3.0/usr/include/x86/mutex.h:#define mtx_lock
> > u.s.mtxs_lock
> > netbsd-10.0/usr/include/x86/mutex.h:#define mtx_lock
> > u.s.mtxs_lock
>
> The MSVC instance surely is not a problem, as WDBGEXTS.H is a MS-Windows
> hardware driver include file that is not intended to be used by
> Gnulib-using apps. The NetBSD instance is not a problem either, as it is
> inside an '#ifdef __MUTEX_PRIVATE' and user apps aren't supposed to mess
> with __MUTEX_PRIVATE. I assume the Minix one is similar to the NetBSD one.
Regarding mtx_lock, I agree the NetBSD and Minix instance is harmless.
Regarding dprintf, however, it seems that the programmers community at large
is defining dprintf as a macro in more than 100 of packages [1]. So, it seems
wise to keep the #undef for this one.
The same argument — what the programmers community does, not what the system
header files do — also holds for the other symbols, to a lesser extent:
There are, for instance, a couple of packages that define mtx_lock as a
macro with arguments. [2][3]
It's hard to predict whether this will turn out as a problem for users who
use GNULIB_POSIXCHECK. I think we can keep the patch that you just committed,
and if no one reports a problem, it's fine.
> > The last one produces a diagnostic, but unfortunately
> > _GL_WARN_ID_LIKE (u.v.w)
> > _GL_WARN_ID_LIKE (u;v;w)
> > don't give a warning or error.
>
> But _GL_WARN_ON_USE would produce an error, right? So we should be OK
> with these anyway, in the sense that we shouldn't have the sort of
> silent failures that I thought was the worry here.
Right. So, I agree to put in this _GL_WARN_ID_LIKE check, but with a
clarification that
- its argument is not necessarily a single token,
- it does not check for "identifier-like" but only for certain characters
such as parentheses.
Something like this: Replace _GL_WARN_ID_LIKE with
/* _GL_ASSERT_SIMPLE_EXPANSION (expansion) checks the macro expansion of an
identifier. It is silent if the expansion is a single C identifier token.
It produces an error if the expansion contains specific characters,
such as parentheses. */
#ifndef _GL_ASSERT_SIMPLE_EXPANSION
# define _GL_ASSERT_SIMPLE_EXPANSION(expansion) \
_GL_WARN_IGNORE (__gl_id_like##expansion##_)
#endif
Also, there was an extraneous backslash in line 140
+ _GL_WARN_ID_LIKE (function) \
that needs to be removed.
Bruno
[1] https://codesearch.debian.net/search?q=%23define+dprintf%28&literal=1
[2] https://codesearch.debian.net/search?q=%23define+mtx_lock%28&literal=1
[3] https://github.com/search?q=%2F%23define+mtx_lock%5B%28%5D%2F&type=code