Skip to content

Commit

Permalink
Merge pull request #273 from parasol-framework/test/cmake
Browse files Browse the repository at this point in the history
[CMake] Removed unnecessary PRE_BUILD parameters
  • Loading branch information
paul-manias authored Nov 17, 2024
2 parents 38e0ce3 + 63a53b8 commit 7ad627c
Show file tree
Hide file tree
Showing 26 changed files with 64 additions and 51 deletions.
7 changes: 6 additions & 1 deletion include/parasol/modules/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -2397,6 +2397,9 @@ static THREADVAR LONG _tlUniqueThreadID = 0;

// For extremely verbose debug logs, run cmake with -DPARASOL_VLOG=ON

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-zero-length"

class Log { // C++ wrapper for Parasol's log functionality
private:
LONG branches;
Expand Down Expand Up @@ -2485,7 +2488,7 @@ class Log { // C++ wrapper for Parasol's log functionality
va_end(arg);
}

void function(CSTRING Message, ...) __attribute__((format(printf, 2, 3))) { // Equivalent to branch() but without a new branch being created
void function(CSTRING Message = "", ...) __attribute__((format(printf, 2, 3))) { // Equivalent to branch() but without a new branch being created
va_list arg;
va_start(arg, Message);
VLogF(VLF::API|VLF::FUNCTION, header, Message, arg);
Expand Down Expand Up @@ -2528,6 +2531,8 @@ class Log { // C++ wrapper for Parasol's log functionality
}
};

#pragma GCC diagnostic pop

class LogLevel {
private:
LONG level;
Expand Down
33 changes: 19 additions & 14 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,25 @@ SET (CORE_DEFS
"${CMAKE_CURRENT_SOURCE_DIR}/compression/class_compression_def.c")

if (BUILD_DEFS)
add_custom_command (OUTPUT
${CORE_DEFS}
"${DOCS}/modules/classes/compressedstream.xml"
"${DOCS}/modules/classes/compression.xml"
"${DOCS}/modules/classes/config.xml"
"${DOCS}/modules/classes/file.xml"
"${DOCS}/modules/classes/metaclass.xml"
"${DOCS}/modules/classes/module.xml"
"${DOCS}/modules/classes/script.xml"
"${DOCS}/modules/classes/storagedevice.xml"
"${DOCS}/modules/classes/task.xml"
"${DOCS}/modules/classes/thread.xml"
"${DOCS}/modules/classes/time.xml"
PRE_BUILD
add_custom_command (
OUTPUT
${CORE_DEFS}
"${DOCS}/modules/classes/compressedstream.xml"
"${DOCS}/modules/classes/compression.xml"
"${DOCS}/modules/classes/config.xml"
"${DOCS}/modules/classes/file.xml"
"${DOCS}/modules/classes/metaclass.xml"
"${DOCS}/modules/classes/module.xml"
"${DOCS}/modules/classes/script.xml"
"${DOCS}/modules/classes/storagedevice.xml"
"${DOCS}/modules/classes/task.xml"
"${DOCS}/modules/classes/thread.xml"
"${DOCS}/modules/classes/time.xml"
"${INCLUDE_OUTPUT}/modules/core.h"
"${INCLUDE_OUTPUT}/system/errors.h"
"${INCLUDE_OUTPUT}/system/registry.h"
"${INCLUDE_OUTPUT}/system/fields.h"
"${CMAKE_CURRENT_SOURCE_DIR}/idl.h"
COMMAND ${PARASOL_CMD} ${IDL_C_SCRIPT} "--log-warning" "src=defs/errors.fdl" "output=${INCLUDE_OUTPUT}/system/errors.h" "sdk=${PROJECT_SOURCE_DIR}"
COMMAND ${PARASOL_CMD} ${IDL_C_SCRIPT} "--log-warning" "src=defs/registry.fdl" "output=${INCLUDE_OUTPUT}/system/registry.h" "sdk=${PROJECT_SOURCE_DIR}"
COMMAND ${PARASOL_CMD} ${IDL_C_SCRIPT} "--log-warning" "src=defs/fields.fdl" "output=${INCLUDE_OUTPUT}/system/fields.h" "sdk=${PROJECT_SOURCE_DIR}"
Expand Down
4 changes: 2 additions & 2 deletions src/core/classes/class_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ static void task_incoming_stdout(WINHANDLE Handle, extTask *Task)
if (recursive) return;
if (!Task->Platform) return;

log.traceBranch("");
log.traceBranch();

char buffer[4096];
LONG size = sizeof(buffer) - 1;
Expand All @@ -311,7 +311,7 @@ static void task_incoming_stderr(WINHANDLE Handle, extTask *Task)
if (recursive) return;
if (!Task->Platform) return;

log.traceBranch("");
log.traceBranch();

char buffer[4096];
LONG size = sizeof(buffer) - 1;
Expand Down
2 changes: 1 addition & 1 deletion src/core/classes/class_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ ERR threadpool_get(extThread **Result)
{
pf::Log log;

log.traceBranch("");
log.traceBranch();

glmThreadPool.lock();

Expand Down
4 changes: 2 additions & 2 deletions src/core/compression/compression_func.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ static ERR fast_scan_zip(extCompression *Self)
pf::Log log(__FUNCTION__);
ziptail tail;

log.traceBranch("");
log.traceBranch();

if (acSeek(Self->FileIO, TAIL_LENGTH, SEEK::END) != ERR::Okay) return ERR::Seek; // Surface error, fail
if (acRead(Self->FileIO, &tail, TAIL_LENGTH, NULL) != ERR::Okay) return ERR::Read; // Surface error, fail
Expand Down Expand Up @@ -568,7 +568,7 @@ static ERR scan_zip(extCompression *Self)
{
pf::Log log(__FUNCTION__);

log.traceBranch("");
log.traceBranch();

if (acSeek(Self->FileIO, 0.0, SEEK::START) != ERR::Okay) return log.warning(ERR::Seek);

Expand Down
7 changes: 6 additions & 1 deletion src/core/defs/core.fdl
Original file line number Diff line number Diff line change
Expand Up @@ -1295,6 +1295,9 @@ static THREADVAR LONG _tlUniqueThreadID = 0;

// For extremely verbose debug logs, run cmake with -DPARASOL_VLOG=ON

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-zero-length"

class Log { // C++ wrapper for Parasol's log functionality
private:
LONG branches;
Expand Down Expand Up @@ -1383,7 +1386,7 @@ class Log { // C++ wrapper for Parasol's log functionality
va_end(arg);
}

void function(CSTRING Message, ...) __attribute__((format(printf, 2, 3))) { // Equivalent to branch() but without a new branch being created
void function(CSTRING Message = "", ...) __attribute__((format(printf, 2, 3))) { // Equivalent to branch() but without a new branch being created
va_list arg;
va_start(arg, Message);
VLogF(VLF::API|VLF::FUNCTION, header, Message, arg);
Expand Down Expand Up @@ -1426,6 +1429,8 @@ class Log { // C++ wrapper for Parasol's log functionality
}
};

#pragma GCC diagnostic pop

class LogLevel {
private:
LONG level;
Expand Down
2 changes: 1 addition & 1 deletion src/core/lib_filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2727,7 +2727,7 @@ ERR load_datatypes(void)
static LARGE user_ts = 0;
bool reload;

log.traceBranch("");
log.traceBranch();

if (!glDatatypes) {
reload = true;
Expand Down
1 change: 0 additions & 1 deletion src/display/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ if (BUILD_DEFS) # Customised idl_c() equivalent, this is for defining the output
"${DOCS}/modules/classes/display.xml"
"${DOCS}/modules/classes/pointer.xml"
"${DOCS}/modules/classes/surface.xml"
PRE_BUILD
COMMAND ${PARASOL_CMD} ${IDL_C_SCRIPT} "--log-warning" "src=${MOD}.fdl" "sdk=${PROJECT_SOURCE_DIR}"
"output-proto=prototypes.h" "output-defs=module_def.c" "files={" ${FUNCTIONS} "lib_surfaces.cpp" "}"
COMMAND ${PARASOL_CMD} ${IDL_COMPILE_SCRIPT} "--log-warning" "src=${MOD}.fdl" "output=${CMAKE_CURRENT_SOURCE_DIR}/idl.h"
Expand Down
2 changes: 1 addition & 1 deletion src/display/class_bitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ static ERR BITMAP_Compress(extBitmap *Self, struct bmp::Compress *Args)

if (Self->Size < 8192) return ERR::Okay;

log.traceBranch("");
log.traceBranch();

if (Self->prvCompress) {
// If the original compression object still exists, all we are going to do is free up the raw bitmap data.
Expand Down
2 changes: 1 addition & 1 deletion src/display/class_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ static ERR DISPLAY_Focus(extDisplay *Self)
{
pf::Log log;

log.traceBranch("");
log.traceBranch();
#ifdef _WIN32
winFocus(Self->WindowHandle);
#elif __xwindows__
Expand Down
2 changes: 1 addition & 1 deletion src/document/draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ static void redraw(extDocument *Self, bool Focus)
{
pf::Log log(__FUNCTION__);

log.traceBranch("");
log.traceBranch();

{
#ifndef RETAIN_LOG_LEVEL
Expand Down
2 changes: 1 addition & 1 deletion src/document/functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ void ui_link::exec(extDocument *Self)

pf::Log log(__FUNCTION__);

log.branch("");
log.branch();

Self->Processing++;

Expand Down
2 changes: 1 addition & 1 deletion src/document/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,7 @@ static void reset_cursor(extDocument *Self)
{
pf::Log log(__FUNCTION__);

log.function("");
log.function();

Self->CursorState = 1;
if (Self->FlashTimer) UpdateTimer(Self->FlashTimer, 0.5);
Expand Down
2 changes: 1 addition & 1 deletion src/fluid/fluid_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ static int input_unsubscribe(lua_State *Lua)
}

pf::Log log("input.unsubscribe");
log.traceBranch("");
log.traceBranch();

if (input->InputValue) { luaL_unref(Lua, LUA_REGISTRYINDEX, input->InputValue); input->InputValue = 0; }
if (input->Callback) { luaL_unref(Lua, LUA_REGISTRYINDEX, input->Callback); input->Callback = 0; }
Expand Down
1 change: 0 additions & 1 deletion src/http/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ if (XXD_CMD STREQUAL "XXD_CMD-NOTFOUND")
message (STATUS "The xxd command is unavailable on this system")
else ()
add_custom_command (OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/auth.c"
PRE_BUILD
COMMAND bash -c "${XXD_CMD} -c20 -i ${CMAKE_CURRENT_SOURCE_DIR}/auth.fluid | sed 's/auth_fluid/glAuthScript/g;s/glAuthScript_len/glAuthScriptLength/g' > auth.c"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Generating C binary from auth.fluid"
Expand Down
2 changes: 1 addition & 1 deletion src/json/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ static ERR txt_to_json(objXML *Self, CSTRING Text)

if ((!Self) or (!Text)) return ERR::NullArgs;

log.traceBranch("");
log.traceBranch();

CSTRING str;
Self->Tags.clear();
Expand Down
2 changes: 1 addition & 1 deletion src/network/clientsocket/clientsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static void clientsocket_outgoing(HOSTHANDLE Void, APTR Data)
return;
}

log.traceBranch("");
log.traceBranch();

#ifdef ENABLE_SSL
if (Socket->SSLBusy) return; // SSL object is performing a background operation (e.g. handshake)
Expand Down
2 changes: 1 addition & 1 deletion src/network/netsocket/netsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ static ERR NETSOCKET_GetLocalIPAddress(extNetSocket *Self, struct ns::GetLocalIP
{
pf::Log log;

log.traceBranch("");
log.traceBranch();

if ((!Args) or (!Args->Address)) return log.warning(ERR::NullArgs);

Expand Down
2 changes: 1 addition & 1 deletion src/network/netsocket/netsocket_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ static void client_server_outgoing(SOCKET_HANDLE Void, extNetSocket *Data)

pf::SwitchContext context(Self);

log.traceBranch("");
log.traceBranch();

#ifdef ENABLE_SSL
if (Self->SSLBusy) return; // SSL object is performing a background operation (e.g. handshake)
Expand Down
8 changes: 4 additions & 4 deletions src/network/ssl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ static ERR sslInit(void)

if (ssl_init) return ERR::Okay;

log.traceBranch("");
log.traceBranch();

SSL_load_error_strings();
ERR_load_BIO_strings();
Expand Down Expand Up @@ -103,7 +103,7 @@ static ERR sslSetup(extNetSocket *Self)

if (Self->CTX) return ERR::Okay;

log.traceBranch("");
log.traceBranch();

if ((Self->CTX = SSL_CTX_new(SSLv23_client_method()))) {
//if (GetResource(RES::LOG_LEVEL) > 3) SSL_CTX_set_info_callback(Self->CTX, (void *)&sslCtxMsgCallback);
Expand Down Expand Up @@ -143,7 +143,7 @@ static ERR sslLinkSocket(extNetSocket *Self)
{
pf::Log log(__FUNCTION__);

log.traceBranch("");
log.traceBranch();

if ((Self->BIO = BIO_new_socket(Self->SocketHandle, BIO_NOCLOSE))) {
SSL_set_bio(Self->SSL, Self->BIO, Self->BIO);
Expand All @@ -169,7 +169,7 @@ static ERR sslConnect(extNetSocket *Self)
{
pf::Log log(__FUNCTION__);

log.traceBranch("");
log.traceBranch();

if (!Self->SSL) return ERR::FieldNotSet;

Expand Down
2 changes: 1 addition & 1 deletion src/scintilla/class_scintilla.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1392,7 +1392,7 @@ static ERR SCINTILLA_TrimWhitespace(extScintilla *Self)
{
pf::Log log;

log.traceBranch("");
log.traceBranch();

LONG cursorpos = SCICALL(SCI_GETCURRENTPOS);
LONG cursorline = SCICALL(SCI_LINEFROMPOSITION, cursorpos);
Expand Down
16 changes: 8 additions & 8 deletions src/scintilla/class_scintilla_ext.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ bool ScintillaParasol::ModifyScrollBars(int nMax, int nPage)
void ScintillaParasol::ReconfigureScrollBars()
{
pf::Log log(__FUNCTION__);
log.traceBranch("");
log.traceBranch();

/*
if (horizontalScrollBarVisible) acShowID(scintilla->HScroll);
Expand All @@ -273,7 +273,7 @@ void ScintillaParasol::ReconfigureScrollBars()
void ScintillaParasol::CopyToClipboard(const Scintilla::SelectionText &selectedText)
{
pf::Log log(__FUNCTION__);
log.traceBranch("");
log.traceBranch();

auto clipboard = objClipboard::create { };
if (clipboard.ok()) {
Expand All @@ -290,7 +290,7 @@ void ScintillaParasol::CopyToClipboard(const Scintilla::SelectionText &selectedT
void ScintillaParasol::Cut()
{
pf::Log log(__FUNCTION__);
log.traceBranch("");
log.traceBranch();

if (SendScintilla(SCI_GETSELECTIONSTART) != SendScintilla(SCI_GETSELECTIONEND)) {
Scintilla::SelectionText text;
Expand All @@ -307,7 +307,7 @@ void ScintillaParasol::Cut()
void ScintillaParasol::Copy()
{
pf::Log log(__FUNCTION__);
log.traceBranch("");
log.traceBranch();

if (SendScintilla(SCI_GETSELECTIONSTART) != SendScintilla(SCI_GETSELECTIONEND)) {
Scintilla::SelectionText text;
Expand All @@ -322,7 +322,7 @@ void ScintillaParasol::Paste()
{
pf::Log log(__FUNCTION__);

log.traceBranch("");
log.traceBranch();

objClipboard::create clipboard = { };
if (clipboard.ok()) {
Expand Down Expand Up @@ -370,7 +370,7 @@ void ScintillaParasol::Paste()
void ScintillaParasol::ClaimSelection()
{
pf::Log log(__FUNCTION__);
log.traceBranch("");
log.traceBranch();
if (!SelectionEmpty()) primarySelection = true;
else primarySelection = false;
}
Expand Down Expand Up @@ -769,7 +769,7 @@ void ScintillaParasol::panDraw(objSurface *TargetSurface, objBitmap *Bitmap)
void ScintillaParasol::panFontChanged(void *Font, void *BoldFont, void *ItalicFont, void *BIFont)
{
pf::Log log(__FUNCTION__);
log.traceBranch("");
log.traceBranch();

glFont = (OBJECTPTR)Font;
glBoldFont = (OBJECTPTR)BoldFont;
Expand Down Expand Up @@ -904,7 +904,7 @@ void ScintillaParasol::panMouseRelease(JET Button, double x, double y)
void ScintillaParasol::panResized()
{
pf::Log log(__FUNCTION__);
log.traceBranch("");
log.traceBranch();
ChangeSize();
}

Expand Down
2 changes: 1 addition & 1 deletion src/svg/gradients.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static const std::vector<GradientStop> process_gradient_stops(extSVG *Self, cons
{
pf::Log log(__FUNCTION__);

log.traceBranch("");
log.traceBranch();

std::vector<GradientStop> stops;
for (auto &scan : Tag.Children) {
Expand Down
2 changes: 1 addition & 1 deletion src/svg/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ static std::vector<Transition> process_transition_stops(extSVG *Self, const objX
{
pf::Log log("process_stops");

log.traceBranch("");
log.traceBranch();

std::vector<Transition> stops;
for (auto &scan : Tags) {
Expand Down
2 changes: 1 addition & 1 deletion src/vector/filters/filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ static ERR VECTORFILTER_Clear(extVectorFilter *Self)
{
pf::Log log;

log.branch("");
log.branch();
while (Self->Effects) FreeResource(Self->Effects);

Self->Bank.clear();
Expand Down
Loading

0 comments on commit 7ad627c

Please sign in to comment.