RFR: 8214976: Warn about uses of functions replaced for portability [v2]
Kim Barrett
kbarrett at openjdk.java.net
Thu Jan 6 10:16:17 UTC 2022
On Thu, 6 Jan 2022 09:57:54 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> Done.
>
> "after all the `#endif`" wasn't quite what I meant. Still needs to be inside the include guard. And I forgot there are platform-specific compilerWarnings files; the gcc macro definitions should be in compilerWarnings_gcc.hpp rather than conditionally defined here. This file should contain something like
>
> #ifndef FORBID_C_FUNCTION
> #define FORBID_C_FUNCTION(signature, alternative)
> #endif
>
> #ifndef PRAGMA_PERMIT_FORBIDDEN_C_FUNCTION
> #define PRAGMA_PERMIT_FORBIDDEN_C_FUNCTION(name)
> #endif
Some of these functions are posix while some are portable (C StdLib). Indeed,
some of the os:: functions exist to provide a shared API with Windows where
none exists natively.
So I think compilerWarnings.hpp should have forbid-decls for only portable
names, and there should be another group (in another file? not sure how to set
it up though. for now just conditional in compilerWarnings.hpp?) for the
posix functions that aren't present in Windows. The additional #includes
should be separated accordingly, as needed.
But need to be careful about <dirent.h>. There's a problem with that header
on XLC. See comment in globalDefinitions_xlc.hpp. Ugh!
-------------
PR: https://git.openjdk.java.net/jdk/pull/6961
More information about the hotspot-dev
mailing list