Skip to content

Commit

Permalink
rework constexpr handling
Browse files Browse the repository at this point in the history
rework using statements
various fixes for compiling c++17 filesystem runtime
various bug fixes
  • Loading branch information
LADSoft committed Aug 24, 2024
1 parent 02fe4d9 commit fe6d34d
Show file tree
Hide file tree
Showing 29 changed files with 699 additions and 270 deletions.
2 changes: 1 addition & 1 deletion src/clibs/cpp/libcxx/src/filesystem/directory_iterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class __dir_stream {
//cdata.__write_time_ = get_write_time(__data_);
__entry_.__assign_iter_entry(
__root_ / __data_.cFileName,
directory_entry::__create_iter_result(detail::get_file_type(__data)));
directory_entry::__create_iter_result(detail::get_file_type(__data_)));
return true;
}
ec = error_code(::GetLastError(), generic_category());
Expand Down
4 changes: 4 additions & 0 deletions src/clibs/cpp/libcxx/src/filesystem/filesystem_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,10 @@ using fs_time = time_util<file_time_type, time_t, TimeSpec>;
#if defined(__APPLE__)
TimeSpec extract_mtime(StatT const& st) { return st.st_mtimespec; }
TimeSpec extract_atime(StatT const& st) { return st.st_atimespec; }
#elif defined(__ORANGEC__)
TimeSpec extract_mtime(StatT const& st) { return { st.st_mtime, 0}; }
TimeSpec extract_atime(StatT const& st) { return { st.st_atime, 0}; }

#else
TimeSpec extract_mtime(StatT const& st) { return st.st_mtim; }
TimeSpec extract_atime(StatT const& st) { return st.st_atim; }
Expand Down
29 changes: 29 additions & 0 deletions src/clibs/cpp/libcxx/src/filesystem/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Software License Agreement
#
# Copyright(C) 1994-2024 David Lindauer, (LADSoft)
#
# This file is part of the Orange C Compiler package.
#
# The Orange C Compiler package is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# The Orange C Compiler package is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Orange C. If not, see <http://www.gnu.org/licenses/>.
#
# contact information:
# email: [email protected] <David Lindauer>
#

CPP_DEPENDENCIES = $(wildcard *.cpp)
H_FILES=$(wildcard *.h)
DEFINES= /DNOMINMAX

all: $(DEPENDENCIES)
$(eval $(FORMATTER))
2 changes: 1 addition & 1 deletion src/clibs/cpp/libcxx/src/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

CPP_DEPENDENCIES = $(wildcard *.cpp)
H_FILES=$(wildcard *.h)
EXCLUDE= debug.o variant.o
EXCLUDE= debug.o

all: $(DEPENDENCIES)
$(MAKE) -CSUPPORT
Expand Down
4 changes: 2 additions & 2 deletions src/clibs/platform/win32/rtl/realpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <errno.h>
#include <io.h>

const char* realpath(const char* path, char* resolved_path)
char* realpath(const char* path, char* resolved_path)
{
if (path == NULL)
{
Expand Down Expand Up @@ -59,4 +59,4 @@ const char* realpath(const char* path, char* resolved_path)
return resolved_path;
}

const char* canonicalize_file_name(const char* path) { return realpath(path, NULL); }
char* canonicalize_file_name(const char* path) { return realpath(path, NULL); }
4 changes: 2 additions & 2 deletions src/clibs/stdinc/stdlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ extern unsigned char _RTL_DATA _osminor;
unsigned long long _RTL_FUNC _IMPORT _bswap64(unsigned long long);

const char* ZSTR _RTL_FUNC getexecname(void);
const char* ZSTR _RTL_FUNC realpath(const char* ZSTR path, char* ZSTR resolved_path);
const char* ZSTR _RTL_FUNC canonicalize_file_name(const char* ZSTR path);
char* ZSTR _RTL_FUNC realpath(const char* ZSTR path, char* ZSTR resolved_path);
char* ZSTR _RTL_FUNC canonicalize_file_name(const char* ZSTR path);

#if defined(__MSIL__)
int* _RTL_FUNC _IMPORT _errno(void);
Expand Down
21 changes: 21 additions & 0 deletions src/clibs/stdinc/sys/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,27 @@ typedef long off_t;
typedef long pid_t;
#endif

#ifndef __blkcnt_t_defined
#define __blkcnt_t
typedef long blkcnt_t;
#endif

#ifndef __blksize_t_defined
#define __blksize_t
typedef long blksize_t;
#endif

#ifndef __fsblkcnt_t_defined
#define __fsblkcnt_t
typedef long fsblkcnt_t;
#endif

#ifndef __fsfilcnt_t_defined
#define __fsfilcnt_t
typedef long fsfilcnt_t;
#endif


typedef long pthread_t;
typedef long pthread_attr_t;

Expand Down
5 changes: 5 additions & 0 deletions src/clibs/stdinc/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@

#define _SC_PAGESIZE 30

# define PATH_MAX 260
# define _PC_PATH_MAX 260

#ifdef __cplusplus
extern "C"
{
Expand All @@ -50,6 +53,8 @@ extern "C"
unsigned _RTL_FUNC _IMPORT alarm(unsigned sec);
ssize_t _RTL_FUNC readlink(const char *path, char *buf, size_t bufsiz);

char* ZSTR _RTL_FUNC _IMPORT getcwd(char* ZSTR, int);

#endif

#ifdef __cplusplus
Expand Down
4 changes: 2 additions & 2 deletions src/occparse/c.h
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,8 @@ typedef std::pair<struct sym*, struct _templateParam*> TEMPLATEPARAMPAIR;
struct ConstExprArgArray
{
unsigned short size;
unsigned short multiplier;
unsigned short multiplier : 15;
unsigned short ref : 1;
struct expr** data;
};

Expand Down Expand Up @@ -662,7 +663,6 @@ typedef struct sym
unsigned allocaUsed : 1;
unsigned oldstyle : 1; /* pointer to a names list if an old style function arg */
unsigned constexpression : 1; /* declared with constexpression */
unsigned ignoreconstructor : 1; /* don't generate code for constexpression constructor */
unsigned addressTaken : 1; /* address taken */
unsigned wasUsing : 1; /* came to this symbol table as a result of 'using' */
unsigned usingTypedef : 1; /* typedef defined as a 'using' statement */
Expand Down
Loading

0 comments on commit fe6d34d

Please sign in to comment.