8305341: Alignment should be enforced by alignas instead of compiler specific attributes

Reviewed-by: mdoerr
This commit is contained in:
Julian Waters 2023-06-25 23:49:49 +00:00
parent c92b049db7
commit 78c3831701
3 changed files with 11 additions and 6 deletions

View File

@ -23,6 +23,7 @@
* questions.
*/
#include <stdalign.h>
#include <stdlib.h>
#include <windows.h>
#include "jni.h"
@ -49,7 +50,7 @@ Java_java_util_prefs_WindowsPreferences_WindowsRegOpenKey(JNIEnv* env,
int errorCode = RegOpenKeyEx((HKEY) hKey, str, 0, securityMask, &handle);
(*env)->ReleaseByteArrayElements(env, lpSubKey, str, 0);
__declspec(align(8)) jlong tmp[2];
alignas(8) jlong tmp[2];
tmp[0] = (jlong) handle;
tmp[1] = errorCode;
jlongArray result = (*env)->NewLongArray(env, 2);
@ -78,7 +79,7 @@ Java_java_util_prefs_WindowsPreferences_WindowsRegCreateKeyEx(JNIEnv* env,
NULL, &handle, &lpdwDisposition);
(*env)->ReleaseByteArrayElements(env, lpSubKey, str, 0);
__declspec(align(8)) jlong tmp[3];
alignas(8) jlong tmp[3];
tmp[0] = (jlong) handle;
tmp[1] = errorCode;
tmp[2] = lpdwDisposition;
@ -196,7 +197,7 @@ Java_java_util_prefs_WindowsPreferences_WindowsRegQueryInfoKey(JNIEnv* env,
&valuesNumber, &maxValueNameLength,
NULL, NULL, NULL);
__declspec(align(8)) jlong tmp[5];
alignas(8) jlong tmp[5];
tmp[0] = subKeysNumber;
tmp[1] = errorCode;
tmp[2] = valuesNumber;

View File

@ -23,6 +23,8 @@
* questions.
*/
#include <stdalign.h>
#include "sun_security_jgss_wrapper_GSSLibStub.h"
#include "NativeUtil.h"
#include "NativeFunc.h"
@ -1189,7 +1191,7 @@ Java_sun_security_jgss_wrapper_GSSLibStub_inquireContext(JNIEnv *env,
OM_uint32 flags;
int isInitiator, isEstablished;
#if defined (_WIN32) && defined (_MSC_VER)
__declspec(align(8))
alignas(8)
#endif
jlong result[6];
jlongArray jresult;

View File

@ -23,6 +23,8 @@
* questions.
*/
#include <stdalign.h>
#include "util.h"
#include "ArrayReferenceImpl.h"
#include "inStream.h"
@ -416,7 +418,7 @@ readLongComponents(JNIEnv *env, PacketInputStream *in,
{
int i;
#if defined (_WIN32) && defined (_MSC_VER)
__declspec(align(8))
alignas(8)
#endif
jlong component;
@ -447,7 +449,7 @@ readDoubleComponents(JNIEnv *env, PacketInputStream *in,
{
int i;
#if defined (_WIN32) && defined (_MSC_VER)
__declspec(align(8))
alignas(8)
#endif
jdouble component;