Skip to content

Commit 295f599

Browse files
committed
adjust after c4core update
1 parent 938663d commit 295f599

9 files changed

Lines changed: 86 additions & 48 deletions

File tree

ext/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ C4CORE_DIR_PROJ = $(C4CORE_DIR_GIT)/src
1717

1818
C4CORE_INPUT_SRC = $(C4CORE_SRC:%=$(C4CORE_DIR_PROJ)/%)
1919
C4CORE_INPUT_DEV = $(C4CORE_DEV:%=$(C4CORE_DIR_PROJ)/%)
20-
C4CORE_INPUT_PROJ = $(C4CORE_DEV:%=$(CORE_DIR_PROJ)/cmake/%)
20+
C4CORE_INPUT_PROJ = $(C4CORE_DEV:%=$(CORE_DIR_GIT)/cmake/%)
2121

2222
C4CORE_OUTPUT_SRC = $(C4CORE_SRC:%=$(C4CORE_DIR_SRC)/%)
2323
C4CORE_OUTPUT_DEV = $(C4CORE_DEV:%=$(C4CORE_DIR_DEV)/%)
@@ -80,14 +80,14 @@ c4core-import-src: $(C4CORE_INPUT_SRC)
8080
c4core-import-dev: $(C4CORE_INPUT_DEV)
8181
$(call mk_safe_sync,$(C4CORE_DEV),$(C4CORE_DIR_PROJ),$(C4CORE_DIR_DEV))
8282
c4core-import-proj: $(C4CORE_INPUT_PROJ)
83-
$(call mk_safe_sync,$(C4CORE_PROJ),$(CORE_DIR_PROJ)/cmake,$(C4PROJ_DIR))
83+
$(call mk_safe_sync,$(C4CORE_PROJ),$(C4CORE_DIR_GIT)/cmake,$(C4PROJ_DIR))
8484

8585
c4core-export-src: $(C4CORE_OUTPUT_SRC)
8686
$(call mk_safe_sync,$(C4CORE_SRC),$(C4CORE_DIR_SRC),$(C4CORE_DIR_PROJ))
8787
c4core-export-dev: $(C4CORE_OUTPUT_DEV)
8888
$(call mk_safe_sync,$(C4CORE_DEV),$(C4CORE_DIR_DEV),$(C4CORE_DIR_PROJ))
8989
c4core-export-proj: $(C4CORE_OUTPUT_PROJ)
90-
$(call mk_safe_sync,$(C4CORE_PROJ),$(C4PROJ_DIR),$(CORE_DIR_PROJ)/cmake)
90+
$(call mk_safe_sync,$(C4CORE_PROJ),$(C4PROJ_DIR),$(CORE_DIR_GIT)/cmake)
9191

9292

9393
$(C4CORE_INPUT_SRC): c4core-clone

ext/c4core.src/c4/compiler.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// Compilers:
1010
// C4_MSVC
11+
// Visual Studio 2026: MSVC++ 18, 1950
1112
// Visual Studio 2022: MSVC++ 17, 1930
1213
// Visual Studio 2019: MSVC++ 16, 1920
1314
// Visual Studio 2017: MSVC++ 15
@@ -24,15 +25,19 @@
2425
/** @see http://sourceforge.net/p/predef/wiki/Compilers/ for a list of compiler identifier macros */
2526
/** @see https://msdn.microsoft.com/en-us/library/b0084kay.aspx for VS2013 predefined macros */
2627

27-
#if defined(_MSC_VER) && !defined(__clang__)
28+
#if defined(_MSC_VER)
2829
# define C4_MSVC
30+
# define C4_MSVC_VERSION_2026 18
2931
# define C4_MSVC_VERSION_2022 17
3032
# define C4_MSVC_VERSION_2019 16
3133
# define C4_MSVC_VERSION_2017 15
3234
# define C4_MSVC_VERSION_2015 14
3335
# define C4_MSVC_VERSION_2013 12
3436
# define C4_MSVC_VERSION_2012 11
35-
# if _MSC_VER >= 1930
37+
# if _MSC_VER >= 1950
38+
# define C4_MSVC_VERSION C4_MSVC_VERSION_2026 // visual studio 2026
39+
# define C4_MSVC_2026
40+
# elif _MSC_VER >= 1930
3641
# define C4_MSVC_VERSION C4_MSVC_VERSION_2022 // visual studio 2022
3742
# define C4_MSVC_2022
3843
# elif _MSC_VER >= 1920

ext/c4core.src/c4/error.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ C4CORE_EXPORT void handle_warning(srcloc s, const char *fmt, ...);
364364
// TODO: add C4_MESSAGE() https://stackoverflow.com/questions/18252351/custom-preprocessor-macro-for-a-conditional-pragma-message-xxx?rq=1
365365

366366

367-
#ifdef C4_MSVC
367+
#if defined(C4_MSVC) && !defined(__clang__)
368368
#define C4_SUPPRESS_WARNING_MSVC_PUSH __pragma(warning(push))
369369
#define C4_SUPPRESS_WARNING_MSVC(w) __pragma(warning(disable : w))
370370
#define C4_SUPPRESS_WARNING_MSVC_POP __pragma(warning(pop))
@@ -375,7 +375,7 @@ C4CORE_EXPORT void handle_warning(srcloc s, const char *fmt, ...);
375375
#endif // C4_MSVC
376376

377377

378-
#ifdef C4_CLANG
378+
#if defined(C4_CLANG) || defined(__clang__)
379379
#define C4_PRAGMA_TO_STR(x) _Pragma(#x)
380380
#define C4_SUPPRESS_WARNING_CLANG_PUSH _Pragma("clang diagnostic push")
381381
#define C4_SUPPRESS_WARNING_CLANG(w) C4_PRAGMA_TO_STR(clang diagnostic ignored w)

ext/c4core.src/c4/memory_util.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ auto lsb(I v) noexcept
101101
// upcast to use the intrinsic, it's cheaper.
102102
#ifdef C4_MSVC
103103
#if !defined(C4_CPU_ARM64) && !defined(C4_CPU_ARM)
104-
unsigned long bit;
104+
unsigned long bit = {};
105105
_BitScanForward(&bit, (unsigned long)v);
106106
return bit;
107107
#else
@@ -128,7 +128,7 @@ auto lsb(I v) noexcept
128128
// Then remember that the upcast makes it to 31bits
129129
#ifdef C4_MSVC
130130
#if !defined(C4_CPU_ARM64) && !defined(C4_CPU_ARM)
131-
unsigned long bit;
131+
unsigned long bit = {};
132132
_BitScanForward(&bit, (unsigned long)v);
133133
return bit;
134134
#else
@@ -153,7 +153,7 @@ auto lsb(I v) noexcept
153153
#if _C4_USE_LSB_INTRINSIC(__builtin_ctz)
154154
#ifdef C4_MSVC
155155
#if !defined(C4_CPU_ARM64) && !defined(C4_CPU_ARM)
156-
unsigned long bit;
156+
unsigned long bit = {};
157157
_BitScanForward(&bit, v);
158158
return bit;
159159
#else
@@ -178,7 +178,7 @@ auto lsb(I v) noexcept
178178
#if _C4_USE_LSB_INTRINSIC(__builtin_ctzl)
179179
#if defined(C4_MSVC)
180180
#if !defined(C4_CPU_ARM64) && !defined(C4_CPU_ARM)
181-
unsigned long bit;
181+
unsigned long bit = {};
182182
_BitScanForward64(&bit, v);
183183
return bit;
184184
#else
@@ -203,7 +203,7 @@ auto lsb(I v) noexcept
203203
#if _C4_USE_LSB_INTRINSIC(__builtin_ctzll)
204204
#if defined(C4_MSVC)
205205
#if !defined(C4_CPU_X86) && !defined(C4_CPU_ARM64) && !defined(C4_CPU_ARM)
206-
unsigned long bit;
206+
unsigned long bit = {};
207207
_BitScanForward64(&bit, v);
208208
return bit;
209209
#else
@@ -310,7 +310,7 @@ auto msb(I v) noexcept
310310
// Then remember that the upcast makes it to 31bits
311311
#ifdef C4_MSVC
312312
#if !defined(C4_CPU_ARM64) && !defined(C4_CPU_ARM)
313-
unsigned long bit;
313+
unsigned long bit = {};
314314
_BitScanReverse(&bit, (unsigned long)v);
315315
return bit;
316316
#else
@@ -337,7 +337,7 @@ auto msb(I v) noexcept
337337
// Then remember that the upcast makes it to 31bits
338338
#ifdef C4_MSVC
339339
#if !defined(C4_CPU_ARM64) && !defined(C4_CPU_ARM)
340-
unsigned long bit;
340+
unsigned long bit = {};
341341
_BitScanReverse(&bit, (unsigned long)v);
342342
return bit;
343343
#else
@@ -362,7 +362,7 @@ auto msb(I v) noexcept
362362
#if _C4_USE_MSB_INTRINSIC(__builtin_clz)
363363
#ifdef C4_MSVC
364364
#if !defined(C4_CPU_ARM64) && !defined(C4_CPU_ARM)
365-
unsigned long bit;
365+
unsigned long bit = {};
366366
_BitScanReverse(&bit, v);
367367
return bit;
368368
#else
@@ -387,7 +387,7 @@ auto msb(I v) noexcept
387387
#if _C4_USE_MSB_INTRINSIC(__builtin_clzl)
388388
#ifdef C4_MSVC
389389
#if !defined(C4_CPU_ARM64) && !defined(C4_CPU_ARM)
390-
unsigned long bit;
390+
unsigned long bit = {};
391391
_BitScanReverse64(&bit, v);
392392
return bit;
393393
#else
@@ -412,7 +412,7 @@ auto msb(I v) noexcept
412412
#if _C4_USE_MSB_INTRINSIC(__builtin_clzll)
413413
#ifdef C4_MSVC
414414
#if !defined(C4_CPU_X86) && !defined(C4_CPU_ARM64) && !defined(C4_CPU_ARM)
415-
unsigned long bit;
415+
unsigned long bit = {};
416416
_BitScanReverse64(&bit, v);
417417
return bit;
418418
#else

ext/c4core.src/c4/substr_fwd.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
#ifndef _C4_SUBSTR_FWD_HPP_
22
#define _C4_SUBSTR_FWD_HPP_
33

4-
#include "c4/export.hpp"
5-
64
namespace c4 {
75

86
#ifndef DOXYGEN
9-
template<class C> C4CORE_EXPORT struct basic_substring;
7+
template<class C> struct basic_substring;
108
using csubstr = basic_substring<const char>;
119
using substr = basic_substring<char>;
1210
template<class T> struct is_string;

ext/c4core.src/c4/utf.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "c4/language.hpp"
55
#include "c4/substr_fwd.hpp"
6+
#include "c4/export.hpp"
67
#include <stddef.h>
78
#include <stdint.h>
89

ext/c4core.src/c4/version.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
/** @file version.hpp */
55

6-
#define C4CORE_VERSION "0.2.10"
6+
#define C4CORE_VERSION "0.2.11"
77
#define C4CORE_VERSION_MAJOR 0
88
#define C4CORE_VERSION_MINOR 2
9-
#define C4CORE_VERSION_PATCH 10
9+
#define C4CORE_VERSION_PATCH 11
1010

1111
#include <c4/export.hpp>
1212

proj/c4proj/amalgamate_utils.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import re
22
import os
3+
import sys
4+
5+
6+
debug_enabled = False
7+
def dbg(*args, **kwargs):
8+
if debug_enabled:
9+
print("//", *args, **kwargs, file=sys.stderr)
310

411

512
class cmtfile:
@@ -57,6 +64,8 @@ class onlyif:
5764
def __init__(self, condition, obj):
5865
self.condition = condition
5966
self.obj = obj
67+
def __str__(self):
68+
return str(self.obj)
6069

6170

6271
def catfiles(filenames, rootdir,
@@ -70,9 +79,9 @@ def catfiles(filenames, rootdir,
7079
to_inject = {}
7180
custom_include_guards = {}
7281
def banner(s):
73-
return f"\n\n\n{sepb}\n{sepf}\n// {s}\n// {repo}/{s}\n{sepf}\n{sepb}\n\n"
82+
return f"\n\n\n{sepb}\n{sepf}\n// {s}\n{sepf}\n{sepb}\n\n"
7483
def footer(s):
75-
return f"\n\n// (end {repo}/{s})\n"
84+
return f"\n\n// (end {s})\n"
7685
def incguard(filename):
7786
return custom_include_guards.get(filename,
7887
f"{file_re.sub('_', filename).upper()}_")
@@ -83,7 +92,7 @@ def replace_include(rx, match, line, guard):
8392
if guard is None:
8493
guard = incguard(incl)
8594
return f"""// amalgamate: removed include of
86-
// {repo}/src/{incl}
95+
// {incl}
8796
//{line}
8897
#if !defined({guard}) && !defined(_{guard})
8998
#error "amalgamate: file {incl} must have been included at this point"
@@ -119,8 +128,10 @@ def cmtline(line, more=""):
119128
for entry in filenames:
120129
if isinstance(entry, onlyif):
121130
if entry.condition:
131+
dbg(entry, "yes")
122132
entry = entry.obj
123133
else:
134+
dbg(entry, "no")
124135
continue
125136
if isinstance(entry, ignfile):
126137
pass

proj/c4proj/c4Project.cmake

Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,13 @@ macro(_c4_handle_semantic_version version)
577577
c4_setg(${prefix}_VERSION_PATCH ${_patch})
578578
c4_setg(${prefix}_VERSION_TWEAK "${_safe_tweak}")
579579
c4_setg(${prefix}_VERSION_TWEAK_FULL "${_tweak}")
580+
c4_setg(${_c4_uprefix}VERSION_FULL ${version})
581+
c4_setg(${_c4_uprefix}VERSION ${_safe_version})
582+
c4_setg(${_c4_uprefix}VERSION_MAJOR ${_major})
583+
c4_setg(${_c4_uprefix}VERSION_MINOR ${_minor})
584+
c4_setg(${_c4_uprefix}VERSION_PATCH ${_patch})
585+
c4_setg(${_c4_uprefix}VERSION_TWEAK "${_safe_tweak}")
586+
c4_setg(${_c4_uprefix}VERSION_TWEAK_FULL "${_tweak}")
580587
endmacro()
581588

582589

@@ -611,6 +618,24 @@ function(c4_add_dev_targets)
611618
add_subdirectory(api)
612619
endif()
613620
endif()
621+
#
622+
# FIXME
623+
c4_add_doxygen(doc DOXYFILE_IN ${_c4_project_dir}/Doxyfile.in
624+
PROJ c4core
625+
INPUT ${${_c4_uprefix}SRC_DIR}
626+
EXCLUDE ${${_c4_uprefix}EXT_DIR} ${${_c4_uprefix}SRC_DIR}/c4/ext
627+
STRIP_FROM_PATH ${${_c4_uprefix}SRC_DIR}
628+
STRIP_FROM_INC_PATH ${${_c4_uprefix}SRC_DIR}
629+
CLANG_DATABASE_PATH ${CMAKE_BINARY_DIR}
630+
)
631+
c4_add_doxygen(doc-full DOXYFILE_IN ${_c4_project_dir}/Doxyfile.full.in
632+
PROJ c4core
633+
INPUT ${${_c4_uprefix}SRC_DIR}
634+
EXCLUDE ${${_c4_uprefix}EXT_DIR} ${${_c4_uprefix}SRC_DIR}/c4/ext
635+
STRIP_FROM_PATH ${${_c4_uprefix}SRC_DIR}
636+
STRIP_FROM_INC_PATH ${${_c4_uprefix}SRC_DIR}
637+
CLANG_DATABASE_PATH ${CMAKE_BINARY_DIR}
638+
)
614639
endfunction()
615640

616641

@@ -1928,14 +1953,27 @@ function(c4_add_target target)
19281953
_c4_handle_arg(SHARED_MACRO ${_c4_uprefix}MACRO)
19291954
_c4_handle_arg(SHARED_EXPORTS ${_c4_uprefix}EXPORTS)
19301955
_c4_handle_arg_or_fallback(SOURCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
1931-
_c4_transform_to_full_path( _SOURCES allsrc ${_SOURCE_ROOT})
1932-
_c4_transform_to_full_path( _HEADERS allsrc ${_SOURCE_ROOT})
1933-
_c4_transform_to_full_path( _PUBLIC_SOURCES allsrc ${_SOURCE_ROOT})
1934-
_c4_transform_to_full_path(_INTERFACE_SOURCES allsrc ${_SOURCE_ROOT})
1935-
_c4_transform_to_full_path( _PRIVATE_SOURCES allsrc ${_SOURCE_ROOT})
1936-
_c4_transform_to_full_path( _PUBLIC_HEADERS allsrc ${_SOURCE_ROOT})
1937-
_c4_transform_to_full_path(_INTERFACE_HEADERS allsrc ${_SOURCE_ROOT})
1938-
_c4_transform_to_full_path( _PRIVATE_HEADERS allsrc ${_SOURCE_ROOT})
1956+
function(_c4_transform_to_full_path list all)
1957+
set(l)
1958+
foreach(f ${${list}})
1959+
if(NOT IS_ABSOLUTE "${f}")
1960+
set(f "${_SOURCE_ROOT}/${f}")
1961+
endif()
1962+
list(APPEND l "${f}")
1963+
endforeach()
1964+
set(${list} "${l}" PARENT_SCOPE)
1965+
set(cp ${${all}})
1966+
list(APPEND cp ${l})
1967+
set(${all} ${cp} PARENT_SCOPE)
1968+
endfunction()
1969+
_c4_transform_to_full_path( _SOURCES allsrc)
1970+
_c4_transform_to_full_path( _HEADERS allsrc)
1971+
_c4_transform_to_full_path( _PUBLIC_SOURCES allsrc)
1972+
_c4_transform_to_full_path(_INTERFACE_SOURCES allsrc)
1973+
_c4_transform_to_full_path( _PRIVATE_SOURCES allsrc)
1974+
_c4_transform_to_full_path( _PUBLIC_HEADERS allsrc)
1975+
_c4_transform_to_full_path(_INTERFACE_HEADERS allsrc)
1976+
_c4_transform_to_full_path( _PRIVATE_HEADERS allsrc)
19391977
create_source_group("" "${_SOURCE_ROOT}" "${allsrc}")
19401978
# is the target name prefixed with the project prefix?
19411979
string(REGEX MATCH "${_c4_prefix}::.*" target_is_prefixed "${target}")
@@ -2144,21 +2182,6 @@ function(c4_add_target target)
21442182
endfunction() # add_target
21452183

21462184

2147-
function(_c4_transform_to_full_path list accumlist _SOURCE_ROOT)
2148-
set(l)
2149-
foreach(f ${${list}})
2150-
if(NOT IS_ABSOLUTE "${f}")
2151-
set(f "${_SOURCE_ROOT}/${f}")
2152-
endif()
2153-
list(APPEND l "${f}")
2154-
endforeach()
2155-
set(${list} "${l}" PARENT_SCOPE)
2156-
set(cp "${${accumlist}}")
2157-
list(APPEND cp "${l}")
2158-
set(${accumlist} "${cp}" PARENT_SCOPE)
2159-
endfunction()
2160-
2161-
21622185
function(_c4_link_with_libs target link_type libs incorporate)
21632186
foreach(lib ${libs})
21642187
# add targets that are DLLs

0 commit comments

Comments
 (0)