8286511: Improve macro allocation

Reviewed-by: azvegint, rhalade, prr
This commit is contained in:
Alexander Zuev 2022-07-14 16:04:45 +00:00 committed by Henry Jen
parent 2cee77444f
commit 400aa2fb2c
3 changed files with 12 additions and 2 deletions

View File

@ -45,6 +45,7 @@ endif
LAUNCHER_SRC := $(TOPDIR)/src/java.base/share/native/launcher
LAUNCHER_CFLAGS += -I$(TOPDIR)/src/java.base/share/native/launcher \
-I$(TOPDIR)/src/java.desktop/share/native/include \
-I$(TOPDIR)/src/java.base/share/native/libjli \
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli \
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libjli \

View File

@ -367,6 +367,7 @@ ifeq ($(call isTargetOs, windows macosx), false)
common/awt/debug \
common/font \
common/java2d/opengl \
include \
#
LIBAWT_HEADLESS_CFLAGS := $(CUPS_CFLAGS) $(FONTCONFIG_CFLAGS) $(X_CFLAGS) \
@ -476,6 +477,7 @@ LIBFONTMANAGER_EXTRA_HEADER_DIRS := \
libawt/java2d \
libawt/java2d/pipe \
libawt/java2d/loops \
include \
#
LIBFONTMANAGER_CFLAGS += $(LIBFREETYPE_CFLAGS)
@ -654,6 +656,8 @@ ifeq ($(ENABLE_HEADLESS_ONLY), false)
common/awt/systemscale \
#
LIBSPLASHSCREEN_HEADER_DIRS += include
ifeq ($(USE_EXTERNAL_LIBGIF), false)
LIBSPLASHSCREEN_HEADER_DIRS += libsplashscreen/giflib
else

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -46,8 +46,13 @@
#define IS_SAFE_SIZE_T(x) ((x) >= 0 && (unsigned long long)(x) <= SIZE_MAX)
#define IS_MUL_OVERFLOW(m, n) \
((m) != 0 && (n) != 0 && (((size_t)((m)*(n))) != (((size_t)(m)) * ((size_t)(n)))))
#define IS_SAFE_SIZE_MUL(m, n) \
(IS_SAFE_SIZE_T(m) && IS_SAFE_SIZE_T(n) && ((m) == 0 || (n) == 0 || (size_t)(n) <= (SIZE_MAX / (size_t)(m))))
(IS_SAFE_SIZE_T(m) && IS_SAFE_SIZE_T(n) && \
((m) == 0 || (n) == 0 || (size_t)(n) <= (SIZE_MAX / (size_t)(m))) && \
!IS_MUL_OVERFLOW(m, n))
#define IS_SAFE_SIZE_ADD(a, b) \
(IS_SAFE_SIZE_T(a) && IS_SAFE_SIZE_T(b) && (size_t)(b) <= (SIZE_MAX - (size_t)(a)))