Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.2] Misc. build and warning fixes to pass CI and compile with recent SCons and GCC/Clang #98900

Merged
merged 21 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0948ca9
[HTML5] Scons now expects "emcc" to be in PATH.
Faless Oct 3, 2020
6bf2e63
CI: Fix Android SDK and NDK setup
akien-mga Nov 7, 2024
2973cce
CI: Update all GitHub actions to their latest version
akien-mga Nov 5, 2024
a2e598b
SCons: Fix Python 3.12 SyntaxError with regex escape sequences
akien-mga Sep 25, 2023
c5d5ba9
Windows: Fix build with SCons 4.2.0
akien-mga Aug 1, 2021
c558ce1
Mono: Replace distutils function with shutil equivalent
akien-mga Apr 25, 2024
4da4280
Android: Replace deprecated distutils LooseVersion usage
akien-mga Nov 5, 2024
6c3befc
iOS: Remove (seemingly?) unneded `extern C` blocks that break build
akien-mga Nov 6, 2024
d70e80e
Fix some array size function definition mismatch.
Faless Aug 4, 2022
9a87271
[Core] Use std type traits to check operations triviality.
Faless Aug 4, 2022
fd669b9
macOS: Fix sprintf deprecation warning
akien-mga Jan 20, 2023
e6cab51
Fix warnings found by Emscripten 3.1.10
akien-mga May 10, 2022
9418bc4
Fix some Clang -Wunused-but-set-variable warnings
akien-mga Dec 20, 2022
74b4fb6
Fix building VHACD with GCC 13.
marxin May 23, 2022
f9c0cd6
Add missing stdint.h includes for GCC 13+
akien-mga Jun 7, 2023
ea1dbdc
Fix GCC 14 -Wtemplate-id-cdtor warnings
akien-mga Apr 26, 2024
87be97b
Fix Xcode deprecation warning about sprintf usage
akien-mga Nov 6, 2024
172dd99
Fix various Clang -Wunused-but-set-variable warnings
akien-mga Aug 18, 2021
5d023b5
SCons: Disable Clang -Wordered-compare-function-pointers warning
akien-mga Jul 15, 2021
e71926c
Ensure flags are applied to CVTT options
madmiraal Dec 25, 2020
b35c7ee
certs: Sync with Mozilla bundle as of Oct 19, 2024
akien-mga Nov 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions .github/workflows/android_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on: [push, pull_request]
# Global Settings
env:
SCONSFLAGS: platform=android verbose=yes warnings=all werror=yes debug_symbols=no --jobs=2
ANDROID_HOME: /home/runner/work/godot/godot/android-sdk
ANDROID_NDK_ROOT: /home/runner/work/godot/godot/android-sdk/ndk/21.1.6352462
ANDROID_NDK_VERSION: 21.1.6352462

jobs:
Expand All @@ -13,7 +15,7 @@ jobs:
name: Template (target=release, tools=no)

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

# Azure repositories are not reliable, we need to prevent azure giving us packages.
- name: Make apt sources.list use the default Ubuntu repositories
Expand All @@ -22,18 +24,23 @@ jobs:
sudo cp -f misc/ci/sources.list /etc/apt/sources.list
sudo apt-get update

- name: Set up Java 8
uses: actions/setup-java@v1
with:
java-version: 8

- name: Install Android NDK r21
- name: Set up Java 8, Android SDK and NDK
run: |
sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install 'ndk;${{env.ANDROID_NDK_VERSION}}'
# Not using actions/setup-java and android-actions/setup-android as I couldn't make them work for such old Java/SDK/NDK combination.
sudo apt-get install openjdk-8-jdk
sudo update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
mkdir -p ${{env.ANDROID_HOME}}
cd ${{env.ANDROID_HOME}}
# Using an old version to be compatible with older Java.
curl -LO https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip
unzip commandlinetools-linux-8512546_latest.zip
yes | ./cmdline-tools/bin/sdkmanager --sdk_root=${{env.ANDROID_HOME}} --licenses
# https://github.com/godotengine/build-containers/blob/3.2/Dockerfile.android
./cmdline-tools/bin/sdkmanager --sdk_root=${{env.ANDROID_HOME}} 'build-tools;28.0.3' 'platforms;android-28' 'cmake;3.10.2.4988404' 'ndk;${{env.ANDROID_NDK_VERSION}}'

# Use python 3.x release (works cross platform)
- name: Set up Python 3.x
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
Expand All @@ -48,8 +55,6 @@ jobs:
scons --version

- name: Compilation
env:
ANDROID_NDK_ROOT: /usr/local/lib/android/sdk/ndk/${{env.ANDROID_NDK_VERSION}}/
run: |
scons target=release tools=no android_arch=armv7
scons target=release tools=no android_arch=arm64v8
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ios_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
name: Template (target=release, tools=no)

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

# Use python 3.x release (works cross platform)
- name: Set up Python 3.x
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/javascript_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
name: Template (target=release, tools=no)

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

# Azure repositories are not reliable, we need to prevent azure giving us packages.
- name: Make apt sources.list use the default Ubuntu repositories
Expand All @@ -25,14 +25,14 @@ jobs:
# Additional cache for Emscripten generated system libraries
- name: Load Emscripten cache
id: javascript-template-emscripten-cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{env.EM_CACHE_FOLDER}}
key: ${{env.EM_VERSION}}-${{github.job}}

# Use python 3.x release (works cross platform)
- name: Set up Python 3.x
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
Expand All @@ -48,7 +48,7 @@ jobs:
scons --version

- name: Set up Emscripten latest
uses: mymindstorm/setup-emsdk@v7
uses: mymindstorm/setup-emsdk@v14
with:
version: ${{env.EM_VERSION}}
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/linux_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
name: Editor w/ Mono (target=release_debug, tools=yes)

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

# Azure repositories are not reliable, we need to prevent azure giving us packages.
- name: Make apt sources.list use the default Ubuntu repositories
Expand All @@ -28,7 +28,7 @@ jobs:

# Use python 3.x release (works cross platform; best to keep self contained in it's own step)
- name: Set up Python 3.x
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
name: Template w/ Mono (target=release, tools=no)

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

# Azure repositories are not reliable, we need to prevent azure giving us packages.
- name: Make apt sources.list use the default Ubuntu repositories
Expand All @@ -73,7 +73,7 @@ jobs:

# Use python 3.x release (works cross platform)
- name: Set up Python 3.x
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/macos_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
name: Editor (target=release_debug, tools=yes)

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

# Use python 3.x release (works cross platform; best to keep self contained in it's own step)
- name: Set up Python 3.x
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
Expand All @@ -42,11 +42,11 @@ jobs:
name: Template (target=release, tools=no)

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

# Use python 3.x release (works cross platform)
- name: Set up Python 3.x
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/server_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
name: Linux Headless w/ Mono (target=release_debug, tools=yes)

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

# Azure repositories are not reliable, we need to prevent azure giving us packages.
- name: Make apt sources.list use the default Ubuntu repositories
Expand All @@ -27,7 +27,7 @@ jobs:

# Use python 3.x release (works cross platform; best to keep self contained in it's own step)
- name: Set up Python 3.x
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
Expand All @@ -52,7 +52,7 @@ jobs:
name: Linux Server w/ Mono (target=release, tools=no)

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

# Azure repositories are not reliable, we need to prevent azure giving us packages.
- name: Make apt sources.list use the default Ubuntu repositories
Expand All @@ -68,7 +68,7 @@ jobs:

# Use python 3.x release (works cross platform)
- name: Set up Python 3.x
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

# Azure repositories are not reliable, we need to prevent Azure giving us packages.
- name: Make apt sources.list use the default Ubuntu repositories
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/windows_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
name: Editor (target=release_debug, tools=yes)

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

# Use python 3.x release (works cross platform; best to keep self contained in it's own step)
- name: Set up Python 3.x
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
Expand All @@ -44,11 +44,11 @@ jobs:
name: Template (target=release, tools=no)

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

# Use python 3.x release (works cross platform)
- name: Set up Python 3.x
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
Expand Down
17 changes: 10 additions & 7 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -407,18 +407,21 @@ if selected_platform in platform_list:
else: # Rest of the world
version = methods.get_compiler_version(env) or [-1, -1]

shadow_local_warning = []
all_plus_warnings = ["-Wwrite-strings"]
common_warnings = []

if methods.using_gcc(env):
env.Append(CCFLAGS=["-Wno-misleading-indentation"])
common_warnings += ["-Wno-misleading-indentation"]
if version[0] >= 7:
shadow_local_warning = ["-Wshadow-local"]
common_warnings += ["-Wshadow-local"]
elif methods.using_clang(env):
# We often implement `operator<` for structs of pointers as a requirement
# for putting them in `Set` or `Map`. We don't mind about unreliable ordering.
common_warnings += ["-Wno-ordered-compare-function-pointers"]

if env["warnings"] == "extra":
# Note: enable -Wimplicit-fallthrough for Clang (already part of -Wextra for GCC)
# once we switch to C++11 or later (necessary for our FALLTHROUGH macro).
env.Append(CCFLAGS=["-Wall", "-Wextra", "-Wno-unused-parameter"] + all_plus_warnings + shadow_local_warning)
env.Append(CCFLAGS=["-Wall", "-Wextra", "-Wwrite-strings", "-Wno-unused-parameter"] + common_warnings)
env.Append(CXXFLAGS=["-Wctor-dtor-privacy", "-Wnon-virtual-dtor"])
if methods.using_gcc(env):
env.Append(
Expand All @@ -434,9 +437,9 @@ if selected_platform in platform_list:
if version[0] >= 9:
env.Append(CCFLAGS=["-Wattribute-alias=2"])
elif env["warnings"] == "all":
env.Append(CCFLAGS=["-Wall"] + shadow_local_warning)
env.Append(CCFLAGS=["-Wall"] + common_warnings)
elif env["warnings"] == "moderate":
env.Append(CCFLAGS=["-Wall", "-Wno-unused"] + shadow_local_warning)
env.Append(CCFLAGS=["-Wall", "-Wno-unused"] + common_warnings)
else: # 'no'
env.Append(CCFLAGS=["-w"])
if env["werror"]:
Expand Down
5 changes: 4 additions & 1 deletion core/bind/core_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,9 @@ struct _OSCoreBindImg {
};

void _OS::print_all_textures_by_size() {

// HACK: This is broken, was fixed in 3.4+, we don't bother here.
// Just comment out to silence warnings.
/*
List<_OSCoreBindImg> imgs;
int total = 0;
{
Expand Down Expand Up @@ -1031,6 +1033,7 @@ void _OS::print_all_textures_by_size() {

total -= E->get().vram;
}
*/
}

void _OS::print_resources_by_type(const Vector<String> &p_types) {
Expand Down
5 changes: 0 additions & 5 deletions core/compressed_translation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) {

int idx = 0;
int total_compression_size = 0;
int total_string_size = 0;

for (List<StringName>::Element *E = keys.front(); E; E = E->next()) {

Expand Down Expand Up @@ -101,7 +100,6 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) {

compressed.write[idx] = ps;
total_compression_size += ps.compressed.size();
total_string_size += src_s.size();
idx++;
}

Expand Down Expand Up @@ -148,16 +146,13 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) {
uint32_t *btw = (uint32_t *)&btwb[0];

int btindex = 0;
int collisions = 0;

for (int i = 0; i < size; i++) {

const Map<uint32_t, int> &t = table[i];
if (t.size() == 0) {
htw[i] = 0xFFFFFFFF; //nothing
continue;
} else if (t.size() > 1) {
collisions += t.size() - 1;
}

htw[i] = btindex;
Expand Down
10 changes: 5 additions & 5 deletions core/cowdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#define COWDATA_H_

#include <string.h>
#include <type_traits>

#include "core/error_macros.h"
#include "core/os/memory.h"
Expand Down Expand Up @@ -199,7 +200,7 @@ void CowData<T>::_unref(void *p_data) {
return; // still in use
// clean up

if (!__has_trivial_destructor(T)) {
if (!std::is_trivially_destructible<T>::value) {
uint32_t *count = _get_size();
T *data = (T *)(count + 1);

Expand Down Expand Up @@ -233,7 +234,7 @@ void CowData<T>::_copy_on_write() {
T *_data = (T *)(mem_new);

// initialize new elements
if (__has_trivial_copy(T)) {
if (std::is_trivially_copyable<T>::value) {
memcpy(mem_new, _ptr, current_size * sizeof(T));

} else {
Expand Down Expand Up @@ -292,7 +293,7 @@ Error CowData<T>::resize(int p_size) {

// construct the newly created elements

if (!__has_trivial_constructor(T)) {
if (!std::is_trivially_constructible<T>::value) {
T *elems = _get_data();

for (int i = *_get_size(); i < p_size; i++) {
Expand All @@ -303,8 +304,7 @@ Error CowData<T>::resize(int p_size) {
*_get_size() = p_size;

} else if (p_size < current_size) {

if (!__has_trivial_destructor(T)) {
if (!std::is_trivially_destructible<T>::value) {
// deinitialize no longer needed elements
for (uint32_t i = p_size; i < *_get_size(); i++) {
T *t = &_get_data()[i];
Expand Down
5 changes: 3 additions & 2 deletions core/io/logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,11 @@ void RotatedFileLogger::rotate_file() {

if (FileAccess::exists(base_path)) {
if (max_files > 1) {
char timestamp[21];
const size_t TIMESTAMP_SIZE = 21;
char timestamp[TIMESTAMP_SIZE];
OS::Date date = OS::get_singleton()->get_date();
OS::Time time = OS::get_singleton()->get_time();
sprintf(timestamp, "_%04d-%02d-%02d_%02d-%02d-%02d", date.year, date.month, date.day, time.hour, time.min, time.sec);
snprintf(timestamp, TIMESTAMP_SIZE, "_%04d-%02d-%02d_%02d-%02d-%02d", date.year, date.month, date.day, time.hour, time.min, time.sec);

String backup_name = base_path.get_basename() + timestamp;
if (base_path.get_extension() != String()) {
Expand Down
Loading