Skip to content

Commit dab29f4

Browse files
committed
Update to GCC 14.1.0
1 parent 34cc8b7 commit dab29f4

14 files changed

+67
-374
lines changed

.github/workflows/build.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ jobs:
5252
- name: Increase swap space
5353
run: |
5454
sudo swapoff -a
55-
sudo fallocate -l 15G '/mnt/swapfile'
55+
sudo fallocate -l '15G' '/mnt/swapfile'
5656
sudo mkswap '/mnt/swapfile'
5757
sudo swapon '/mnt/swapfile'
5858
- name: Install required dependencies
5959
run: |
60-
sudo apt-get install libxml2-dev
60+
sudo apt-get install 'libxml2-dev'
6161
- name: Setup Linux cross-compiler
6262
run: |
6363
declare -r SPHYNX_TAG="$(jq --raw-output '.tag_name' <<< "$(curl --connect-timeout '10' --retry '15' --retry-all-errors --fail --silent --url 'https://api.github.com/repos/AmanoTeam/Sphynx/releases/latest')")"
@@ -269,7 +269,7 @@ jobs:
269269
echo '/tmp/nul/bin' >> "${GITHUB_PATH}"
270270
- name: Build with CMake
271271
run: |
272-
declare -r targets=(
272+
declare -ra targets=(
273273
x86_64-unknown-linux-gnu
274274
# hppa-unknown-openbsd
275275
arm-unknown-openbsd
@@ -391,7 +391,7 @@ jobs:
391391
for target in "${targets[@]}"; do
392392
echo "Building for ${target}"
393393
394-
KAI_ENABLE_LTO='ON'
394+
KAI_ENABLE_LTO='OFF'
395395
396396
if [[ "${target}" == *-apple-darwin ]] || [[ "${target}" == *-w64-mingw32 ]] || [[ "${target}" == *-unknown-openbsd ]]; then
397397
KAI_ENABLE_LTO=OFF
@@ -401,7 +401,7 @@ jobs:
401401
-DKAI_ENABLE_LTO="${KAI_ENABLE_LTO}" \
402402
-DCMAKE_TOOLCHAIN_FILE="./.github/workflows/cmake_toolchains/${target}.cmake" \
403403
-DCMAKE_INSTALL_PREFIX="${target}" \
404-
-DCMAKE_BUILD_TYPE='MinSizeRel' ../
404+
-DCMAKE_BUILD_TYPE='MinSizeRel' ../ 1>/dev/null
405405
406406
pushd './ffmpeg-build'
407407
make --jobs 1>/dev/null
@@ -412,6 +412,8 @@ jobs:
412412
cmake --build ./ -- --jobs 1>/dev/null
413413
cmake --install ./ --strip 1>/dev/null
414414
415+
chmod 644 "${target}/lib/libav"*
416+
415417
if [[ "${target}" == *'mingw32' ]]; then
416418
zip --recurse-paths -9 "${OUTPUT_DIRECTORY}/${target}.zip" "${target}" 1>/dev/null
417419
else

CMakeLists.txt

+3-16
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,7 @@ set(
442442
--enable-small
443443
--enable-version3
444444
--extra-cflags=-Dstatic_assert=_Static_assert
445+
--extra-cflags=-w
445446
--extra-ldflags=-fPIC
446447
--prefix="${FFMPEG_INSTALL_PREFIX}"
447448
)
@@ -646,7 +647,7 @@ foreach(source ${libraries})
646647
endif()
647648

648649
if (UNIX)
649-
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Android")
650+
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Android" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD")
650651
string(APPEND destination "${CMAKE_SHARED_LIBRARY_SUFFIX}")
651652
elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
652653
string(APPEND destination "${SOVERSION_SEPARATOR}${major_version}${CMAKE_SHARED_LIBRARY_SUFFIX}")
@@ -714,16 +715,9 @@ add_executable(
714715
src/showformats.c
715716
src/callbacks.c
716717
src/resources.c
718+
src/biggestint.c
717719
)
718720

719-
if (NOT (WIN32 OR SERENITYOS))
720-
target_sources(
721-
kai
722-
PRIVATE
723-
src/getdents.c
724-
)
725-
endif()
726-
727721
foreach(target kai)
728722
target_compile_options(
729723
${target}
@@ -855,13 +849,6 @@ target_link_libraries(
855849
# libswresample
856850
)
857851

858-
if (WIN32)
859-
target_link_libraries(
860-
kai
861-
shlwapi
862-
)
863-
endif()
864-
865852
foreach(target kai bearssl libcurl_shared)
866853
install(
867854
TARGETS ${target}

src/biggestint.c

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include <stdint.h>
2+
3+
#include "biggestint.h"
4+
5+
bigint_t ptobigint(const void* const pointer) {
6+
/*
7+
Convert a pointer to a bigint_t.
8+
*/
9+
10+
const intptr_t value = (intptr_t) pointer;
11+
const bigint_t result = (bigint_t) value;
12+
13+
return result;
14+
15+
}
16+
17+
biguint_t ptobiguint(const void* const pointer) {
18+
/*
19+
Convert a pointer to a biguint_t.
20+
*/
21+
22+
const uintptr_t value = (uintptr_t) pointer;
23+
const biguint_t result = (biguint_t) value;
24+
25+
return result;
26+
27+
}

src/biggestint.h

+3
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,7 @@ typedef long double bigfloat_t;
3737
#define strtobui strtoul
3838
#endif
3939

40+
bigint_t ptobigint(const void* const pointer);
41+
biguint_t ptobiguint(const void* const pointer);
42+
4043
#endif

src/filesystem.c

-125
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#if defined(_WIN32)
55
#include <windows.h>
66
#include <fileapi.h>
7-
#include <shlwapi.h>
87
#endif
98

109
#if defined(__FreeBSD__)
@@ -41,10 +40,6 @@
4140
#include "walkdir.h"
4241
#include "pathsep.h"
4342

44-
#if !(defined(_WIN32) || defined(__serenity__))
45-
#include "getdents.h"
46-
#endif
47-
4843
#if defined(_WIN32) || defined(__OpenBSD__)
4944
#include "path.h"
5045
#endif
@@ -466,126 +461,6 @@ int directory_exists(const char* const directory) {
466461

467462
}
468463

469-
int directory_empty(const char* const directory) {
470-
/*
471-
Determines whether a specified path is an empty directory.
472-
473-
Returns (1) if directory is empty, (0) if it does not, (-1) on error.
474-
*/
475-
476-
#if defined(_WIN32)
477-
DWORD attributes = 0;
478-
BOOL status = FALSE;
479-
480-
#if defined(_UNICODE)
481-
wchar_t* wdirectory = NULL;
482-
483-
/* This prefix is required to support long paths in Windows 10+ */
484-
const size_t prefixs = isabsolute(directory) ? wcslen(WIN10_LONG_PATH_PREFIX) : 0;
485-
486-
const int wdirectorys = MultiByteToWideChar(CP_UTF8, 0, directory, -1, NULL, 0);
487-
488-
if (wdirectorys == 0) {
489-
return -1;
490-
}
491-
492-
wdirectory = malloc(prefixs + (size_t) wdirectorys);
493-
494-
if (wdirectory == NULL) {
495-
return -1;
496-
}
497-
498-
if (prefixs > 0) {
499-
wcscpy(wdirectory, WIN10_LONG_PATH_PREFIX);
500-
}
501-
502-
if (MultiByteToWideChar(CP_UTF8, 0, directory, -1, wdirectory + prefixs, wdirectorys) == 0) {
503-
free(wdirectory);
504-
return -1;
505-
}
506-
507-
attributes = GetFileAttributesW(wdirectory);
508-
#else
509-
attributes = GetFileAttributesA(directory);
510-
#endif
511-
512-
if (attributes == INVALID_FILE_ATTRIBUTES) {
513-
#if defined(_UNICODE)
514-
free(wdirectory);
515-
#endif
516-
517-
return -1;
518-
}
519-
520-
if ((attributes & FILE_ATTRIBUTE_DIRECTORY) == 0) {
521-
#if defined(_UNICODE)
522-
free(wdirectory);
523-
#endif
524-
525-
return -1;
526-
}
527-
528-
#if defined(_UNICODE)
529-
status = PathIsDirectoryEmptyW(wdirectory);
530-
#else
531-
status = PathIsDirectoryEmptyA(directory);
532-
#endif
533-
534-
#if defined(_UNICODE)
535-
free(wdirectory);
536-
#endif
537-
538-
return (int) status;
539-
#else
540-
#if !defined(__serenity__)
541-
long index = 0;
542-
543-
directory_entry_t item;
544-
directory_entry_t items[3];
545-
546-
const int fd = open_dir(directory);
547-
548-
if (fd == -1) {
549-
return -1;
550-
}
551-
552-
while (1) {
553-
const ssize_t size = get_directory_entries(fd, (char*) items, sizeof(items));
554-
555-
if (size == 0) {
556-
close_dir(fd);
557-
break;
558-
}
559-
560-
if (size == -1) {
561-
close_dir(fd);
562-
563-
if (errno == EINVAL) {
564-
return 0;
565-
}
566-
567-
return -1;
568-
}
569-
570-
for (index = 0; index < size;) {
571-
const char* const ptr = (((char*) items) + index);
572-
memcpy(&item, ptr, sizeof(item));
573-
574-
if (!(strcmp(item.d_name, ".") == 0 || strcmp(item.d_name, "..") == 0)) {
575-
close(fd);
576-
return 0;
577-
}
578-
579-
index += directory_entry_size(&item);
580-
}
581-
}
582-
#endif
583-
584-
return 1;
585-
#endif
586-
587-
}
588-
589464
int file_exists(const char* const filename) {
590465
/*
591466
Checks if file exists and is a regular file or symlink.

src/filesystem.h

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ int file_exists(const char* const filename);
88
int create_directory(const char* const directory);
99
int move_file(const char* const source, const char* const destination);
1010
int copy_file(const char* const source, const char* const destination);
11-
int directory_empty(const char* const directory);
1211

1312
#define remove_directory(directory) remove_recursive(directory, 1)
1413
#define remove_directory_contents(directory) remove_recursive(directory, 0)

0 commit comments

Comments
 (0)