Skip to content

Commit c1c3d06

Browse files
committed
Fix assorted compilation errors, disable Unity builds for CI
1 parent f2291cd commit c1c3d06

18 files changed

+40
-47
lines changed

.github/workflows/ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
- name: Configure CMake
4242
run: >
4343
cmake -B ${{ github.workspace }}/build
44+
-DCMAKE_UNITY_BUILD=OFF
4445
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
4546
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
4647
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}

CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/ma
7070
# intermediate configuration directory.
7171
set_property(GLOBAL PROPERTY XCODE_EMIT_EFFECTIVE_PLATFORM_NAME OFF)
7272

73+
# Build all static libraries with -fPIC.
74+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
75+
7376
# Include modules builtin to CMake
7477
include(GNUInstallDirs) # Defines CMAKE_INSTALL_<dir> variables
7578

src/Config.cmake

-20
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,6 @@ option(BUILD_SHARED_LIBS
2626
Utilities/tools/binaries/etc are then dynamically linked to the
2727
libraries instead of being statically linked." ${_default_shared})
2828

29-
# The character used to separate components of an OS-specific
30-
# directory name depends on the platform (it is '/' on Unix, '\' on
31-
# Windows). That character selection is hardcoded into Panda and
32-
# cannot be changed here. (Note that an internal Panda filename
33-
# always uses the forward slash, '/', to separate the components of a
34-
# directory name.)
35-
36-
# There's a different character used to separate the complete
37-
# directory names in a search path specification. On Unix, the
38-
# normal convention is ':', on Windows, it has to be ';', because the
39-
# colon is already used to mark the drive letter. This character is
40-
# selectable here. Most users won't want to change this. If
41-
# multiple characters are placed in this string, any one of them may
42-
# be used as a separator character.
43-
if(WIN32)
44-
set(DEFAULT_PATHSEP ";")
45-
else()
46-
set(DEFAULT_PATHSEP ":")
47-
endif()
48-
4929

5030
# The following options relate to interrogate, the tool that is
5131
# used to generate bindings for non-C++ languages.

src/cppparser/cppAttributeList.h

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
//#include "dtoolbase.h"
1818

1919
#include <vector>
20+
#include <string>
2021

2122
class CPPExpression;
2223
class CPPIdentifier;

src/cppparser/cppBison.cxx.prebuilt

+1-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ pop_struct() {
294294
# endif
295295
# endif
296296

297-
#include "cppBison.yxx.h"
297+
#include "cppBison.h"
298298
/* Symbol kind. */
299299
enum yysymbol_kind_t
300300
{

src/cppparser/cppDeclaration.h

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <vector>
2626
#include <map>
2727
#include <set>
28+
#include <ostream>
2829

2930
class CPPInstance;
3031
class CPPTemplateParameterList;

src/cppparser/cppManifest.cxx

+2-2
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,10 @@ extract_args(vector_string &args, const string &expr, size_t &p) const {
313313
}
314314
}
315315

316-
if ((int)args.size() < _num_parameters) {
316+
if (args.size() < _num_parameters) {
317317
_parser.warning("Not enough arguments for manifest " + _name);
318318
}
319-
else if (_variadic_param < 0 && (int)args.size() > _num_parameters) {
319+
else if (_variadic_param < 0 && args.size() > _num_parameters) {
320320
_parser.warning("Too many arguments for manifest " + _name);
321321
}
322322
}

src/dtoolbase/dtoolsymbols.h

+5-14
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,12 @@
7272
#define BUILDING_DTOOL_DTOOLUTIL
7373
#endif
7474

75-
#ifdef BUILDING_DTOOL_DTOOLBASE
76-
#define EXPCL_DTOOL_DTOOLBASE EXPORT_CLASS
77-
#define EXPTP_DTOOL_DTOOLBASE EXPORT_TEMPL
78-
#else
79-
#define EXPCL_DTOOL_DTOOLBASE IMPORT_CLASS
80-
#define EXPTP_DTOOL_DTOOLBASE IMPORT_TEMPL
81-
#endif
75+
// These are always built statically at the moment.
76+
#define EXPCL_DTOOL_DTOOLBASE
77+
#define EXPTP_DTOOL_DTOOLBASE
8278

83-
#ifdef BUILDING_DTOOL_DTOOLUTIL
84-
#define EXPCL_DTOOL_DTOOLUTIL EXPORT_CLASS
85-
#define EXPTP_DTOOL_DTOOLUTIL EXPORT_TEMPL
86-
#else
87-
#define EXPCL_DTOOL_DTOOLUTIL IMPORT_CLASS
88-
#define EXPTP_DTOOL_DTOOLUTIL IMPORT_TEMPL
89-
#endif
79+
#define EXPCL_DTOOL_DTOOLUTIL
80+
#define EXPTP_DTOOL_DTOOLUTIL
9081

9182
#ifdef BUILDING_INTERROGATEDB
9283
#define EXPCL_INTERROGATEDB EXPORT_CLASS

src/dtoolbase/pstrtod.cxx

+3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616
#include <ctype.h>
1717
#include <math.h>
1818
#include <limits>
19+
#include <string.h>
1920

2021
#ifdef _WIN32
2122
#define strncasecmp _strnicmp
23+
#else
24+
#include <strings.h>
2225
#endif
2326

2427
/**

src/dtoolutil/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ foreach(var
7373

7474
endforeach(var)
7575

76-
# dSearchPath.cxx:
77-
target_compile_definitions(dtoolutil PRIVATE "DEFAULT_PATHSEP=\"${DEFAULT_PATHSEP}\"")
78-
7976
# Public definitions for getopt.
8077
foreach(var
8178
HAVE_GETOPT

src/dtoolutil/dSearchPath.cxx

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
#include <algorithm>
1818
#include <iterator>
1919

20+
#ifdef _WIN32
21+
#define DEFAULT_PATHSEP ";"
22+
#else
23+
#define DEFAULT_PATHSEP ":"
24+
#endif
25+
2026
using std::ostream;
2127
using std::string;
2228

src/dtoolutil/filename.I

+1-2
Original file line numberDiff line numberDiff line change
@@ -594,10 +594,9 @@ operator < (const std::string &other) const {
594594
*/
595595
INLINE int Filename::
596596
compare_to(const Filename &other) const {
597-
return strcmp(_filename.c_str(), other._filename.c_str());
597+
return _filename.compare(other._filename);
598598
}
599599

600-
601600
/**
602601
* Returns true if the Filename is valid (not empty), or false if it is an
603602
* empty string.

src/dtoolutil/filename.cxx

+5-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
#include <unistd.h>
3131
#endif
3232

33+
#ifdef _MSC_VER
34+
#include <malloc.h>
35+
#endif
36+
3337
#ifdef PHAVE_GLOB_H
3438
#include <glob.h>
3539
#ifndef GLOB_NOMATCH
@@ -144,7 +148,7 @@ get_panda_root() {
144148
char *envvar = nullptr;
145149
size_t size = 0;
146150
while (getenv_s(&size, envvar, size, "PANDA_ROOT") == ERANGE) {
147-
envvar = (char *)alloca(size);
151+
envvar = (char *)_alloca(size);
148152
}
149153
if (size != 0) {
150154
(*panda_root) = front_to_back_slash(envvar);

src/dtoolutil/textEncoder.h

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
#include "unicodeLatinMap.h"
1919

2020
#include <ctype.h>
21+
#include <istream>
22+
#include <ostream>
23+
#include <string>
2124

2225
class StringDecoder;
2326

src/dtoolutil/win32ArgParser.cxx

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ do_glob() {
147147
// means to do it.
148148
std::string envvar(128, '\0');
149149
size_t size = envvar.size();
150-
while (getenv_s(&size, &envvar[0], size, var.c_str()) == ERANGE) {
150+
while (getenv_s(&size, &envvar[0], size, "PANDA_GLOB") == ERANGE) {
151151
envvar.resize(size);
152152
}
153153
if (size > 1) {

src/interrogate/interrogateBuilder.cxx

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949

5050
#include <ctype.h>
5151
#include <algorithm>
52+
#include <cstring>
5253

5354
using std::cerr;
5455
using std::istream;
@@ -564,7 +565,7 @@ write_code(ostream &out_code,ostream * out_include, InterrogateModuleDef *def) {
564565
InterrogateModuleDef *InterrogateBuilder::
565566
make_module_def(int file_identifier) {
566567
InterrogateModuleDef *def = new InterrogateModuleDef;
567-
memset(def, 0, sizeof(InterrogateModuleDef));
568+
std::memset(def, 0, sizeof(InterrogateModuleDef));
568569

569570
def->file_identifier = file_identifier;
570571
def->library_name = library_name.c_str();

src/interrogatedb/interrogate_datafile.cxx

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
#include "interrogate_datafile.h"
1515

16+
#include <cstring>
17+
1618
using std::istream;
1719
using std::ostream;
1820
using std::string;
@@ -60,7 +62,7 @@ idf_output_string(ostream &out, const char *str, char whitespace) {
6062
if (str == nullptr) {
6163
out << "0 ";
6264
} else {
63-
out << strlen(str) << whitespace;
65+
out << std::strlen(str) << whitespace;
6466
if (str[0] != '\0') {
6567
out << str << whitespace;
6668
}

src/interrogatedb/interrogate_datafile.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
// This file defines some convenience functions for reading and writing the
1818
// interrogate database files.
1919

20-
#include "dtoolbase.h"
2120
#include <vector>
21+
#include <istream>
22+
#include <ostream>
2223

2324
void idf_output_string(std::ostream &out, const std::string &str, char whitespace = ' ');
2425
void idf_input_string(std::istream &in, std::string &str);

0 commit comments

Comments
 (0)