1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3#include <config.h>
4
5#include <cstdio>
6
7#include <stdlib.h>
8#include <stdio.h>
9#include <stdarg.h>
10#include <qdebug.h>
11#include <FilePrintStream.h>
12
13#if ENABLE(ASSEMBLER) && CPU(X86) && !OS(MAC_OS_X)
14#include <MacroAssemblerX86Common.h>
15#endif
16
17namespace WTF {
18
19void* fastMalloc(size_t size)
20{
21 return malloc(size: size);
22}
23
24void* fastRealloc(void* ptr, size_t size)
25{
26 return realloc(ptr: ptr, size: size);
27}
28
29void fastFree(void* ptr)
30{
31 free(ptr: ptr);
32}
33
34uint32_t cryptographicallyRandomNumber()
35{
36 return 0;
37}
38
39static FilePrintStream* s_dataFile = nullptr;
40
41void setDataFile(FilePrintStream *ps)
42{
43 delete s_dataFile;
44 s_dataFile = ps;
45}
46
47void setDataFile(FILE* f)
48{
49 delete s_dataFile;
50 s_dataFile = new FilePrintStream(f, FilePrintStream::Borrow);
51}
52
53FilePrintStream& dataFile()
54{
55 if (!s_dataFile)
56 s_dataFile = new FilePrintStream(stderr, FilePrintStream::Borrow);
57 return *s_dataFile;
58}
59
60void dataLogFV(const char* format, va_list args)
61{
62 char buffer[1024];
63 std::vsnprintf(s: buffer, maxlen: sizeof(buffer), format: format, arg: args);
64 qDebug().nospace().noquote() << buffer;
65}
66
67void dataLogF(const char* format, ...)
68{
69 char buffer[1024];
70 va_list args;
71 va_start(args, format);
72 std::vsnprintf(s: buffer, maxlen: sizeof(buffer), format: format, arg: args);
73 va_end(args);
74 qDebug().nospace().noquote() << buffer;
75}
76
77void dataLogFString(const char* str)
78{
79 qDebug().nospace().noquote() << str;
80}
81
82}
83
84extern "C" {
85// When adding a new stub here do not forget to add
86// DEFINES += StubFunctionName=qmlStubFunctionName
87// for example:
88// DEFINES += WTFReportAssertionFailureWithMessage=qmlWTFReportAssertionFailureWithMessage
89// to prevent "duplicate symbol" error during static library linking. See bugs QTBUG-35041 and QTBUG-63050
90
91void WTFReportAssertionFailure(const char* file, int line, const char* function, const char*assertion)
92{
93 fprintf(stderr, format: "WTF failing assertion in %s, line %d, function %s: %s\n", file, line, function, assertion);
94}
95
96void WTFReportAssertionFailureWithMessage(const char* file, int line, const char* function, const char* assertion, const char* format, ...)
97{
98 // TODO: show the message, or remove this function completely. (The latter would probably be best.)
99 Q_UNUSED(format);
100 fprintf(stderr, format: "WTF failing assertion in %s, line %d, function %s: %s\n", file, line, function, assertion);
101}
102
103void WTFReportBacktrace()
104{
105}
106
107void WTFInvokeCrashHook()
108{
109}
110
111}
112
113
114#if ENABLE(ASSEMBLER) && CPU(X86) && !OS(MAC_OS_X)
115JSC::MacroAssemblerX86Common::SSE2CheckState JSC::MacroAssemblerX86Common::s_sse2CheckState = JSC::MacroAssemblerX86Common::NotCheckedSSE2;
116#endif
117
118

Provided by KDAB

Privacy Policy
Learn to use CMake with our Intro Training
Find out more

source code of qtdeclarative/src/3rdparty/masm/stubs/WTFStubs.cpp