Skip to content

Commit 2c7d66c

Browse files
committed
Use fmt:::format instead of fmt::sprintf
1 parent ca0ff84 commit 2c7d66c

File tree

132 files changed

+1225
-1354
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+1225
-1354
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ jobs:
3939
- name: Install MacOS dependencies
4040
if: matrix.os == 'macos-latest'
4141
run: |
42+
brew update
43+
brew upgrade
4244
brew install boost fmt gmp llvm@15 ninja pkg-config sbcl ecl netcdf expat
4345
- name: Checkout repository
4446
uses: actions/checkout@v3

include/clasp/asttooling/clangTooling.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class DerivableFrontendActionFactory : public clbind::Derivable<clang::tooling::
127127
}
128128

129129
clang::FrontendAction *default_create() {
130-
SIMPLE_ERROR_SPRINTF("Subclass must implement create");
130+
SIMPLE_ERROR("Subclass must implement create");
131131
};
132132
};
133133

@@ -158,7 +158,7 @@ class DerivableMatchCallback
158158
}
159159

160160
void default_run(const clang::ast_matchers::MatchFinderMatchResult &Result) {
161-
SIMPLE_ERROR_SPRINTF("Subclass must implement");
161+
SIMPLE_ERROR("Subclass must implement");
162162
};
163163

164164
virtual void onStartOfTranslationUnit() {
@@ -229,7 +229,7 @@ namespace translate {
229229
printf("Invoking o.px_ref()->describe(); /* A virtual function */\n");
230230
o.px_ref()->describe();
231231
#endif
232-
SIMPLE_ERROR_SPRINTF("Could not convert %s of RTTI type %s to %s",_rep_(o).c_str(),typeid(o).name(), typeid(asttooling::DerivableMatchCallback*).name() );
232+
SIMPLE_ERROR("Could not convert {} of RTTI type {} to {}",_rep_(o), typeid(o).name(), typeid(asttooling::DerivableMatchCallback*).name());
233233
}
234234
};
235235

include/clasp/asttooling/translators.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ struct from_object<const vector<string> &> {
9292
}
9393
return;
9494
}
95-
SIMPLE_ERROR_SPRINTF("Add support to convert %s to vector<string>", _rep_(o).c_str());
95+
SIMPLE_ERROR("Add support to convert {} to vector<string>", _rep_(o));
9696
}
9797
};
9898

include/clasp/clbind/adapter.fwd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ THE SOFTWARE.
3030
namespace clbind {
3131

3232
inline void throwSlotsNotSupported() {
33-
SIMPLE_ERROR_SPRINTF("Slots are not supported by this class");
33+
SIMPLE_ERROR("Slots are not supported by this class");
3434
}
3535

3636
/*! Add the enable_derivable type to Adapter or Derivable

include/clasp/clbind/class.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class DummyCreator_O : public core::Creator_O {
139139
virtual size_t templatedSizeof() const override { return sizeof(*this); };
140140
virtual bool allocates() const override { return false; };
141141
virtual core::T_sp creator_allocate() override {
142-
SIMPLE_ERROR_SPRINTF("This class named: %s cannot allocate instances", core::_rep_(this->_name).c_str());
142+
SIMPLE_ERROR("This class named: {} cannot allocate instances", core::_rep_(this->_name));
143143
} // return _Nil<core::T_O>(); };
144144
core::Creator_sp duplicateForClassName(core::Symbol_sp className) override {
145145
core::GlobalSimpleFun_sp entryPoint =

include/clasp/clbind/clbind_wrappers.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,13 @@ void* mostDerivedPointer() const { return (void*)RawGetter<HolderType>::get_poin
197197
obj->_setInstanceClassUsingSymbol(classSymbol);
198198
return obj;
199199
}
200-
SIMPLE_ERROR("In make_wrapper for a class class_id %d\n"
200+
SIMPLE_ERROR("In make_wrapper for a class class_id {}\n"
201201
" the classSymbol could not be identified\n"
202202
" this probably means that you are trying to wrap an unexposed class\n"
203203
" OR you don't have an appropriate to_object translator for the type\n"
204204
" that corresponds to this class_id.\n"
205205
" Connect a debugger and check if:\n"
206-
" struct to_object<T &, translate::dont_adopt_pointer> is on the stack", dynamic_id );
206+
" struct to_object<T &, translate::dont_adopt_pointer> is on the stack", dynamic_id);
207207
}
208208

209209
static gctools::smart_ptr<WrapperType> make_wrapper(const OT &val, class_id dynamic_id ) {
@@ -229,7 +229,7 @@ void* mostDerivedPointer() const { return (void*)RawGetter<HolderType>::get_poin
229229
bool validp() const { return RawGetter<HolderType>::get_pointer(this->p_gc_ignore) != NULL; };
230230
void throwIfInvalid() const {
231231
if (!this->validp()) {
232-
SIMPLE_ERROR_SPRINTF("The wrapper is invalid");
232+
SIMPLE_ERROR("The wrapper is invalid");
233233
}
234234
};
235235

@@ -579,7 +579,7 @@ struct from_object<std::unique_ptr<T>> {
579579
core::General_O* gp = (core::General_O*)&(*o);
580580
T* v_alien = reinterpret_cast<T*>(gp->pointerToAlienWithin());
581581
if (!v_alien) {
582-
SIMPLE_ERROR_SPRINTF("Wrong type of argument - clbind object@%p of type: %s", (void*)gp, typeid(T).name());
582+
SIMPLE_ERROR("Wrong type of argument - clbind object@{} of type: {}", (void*)gp, typeid(T).name());
583583
}
584584

585585
ASSERT(v_alien);
@@ -596,7 +596,7 @@ struct from_object<std::unique_ptr<T>> {
596596
printf("o.px_ref() = %p\n", go.raw_());
597597
printf("typeid(T*)@%p typeid(T*).name=%s\n", &typeid(T *), typeid(T *).name());
598598
printf("typeid(clbind::Derivable<T>*)@%p typeid(clbind::Derivable<T>*).name() = %s\n", &typeid(clbind::Derivable<T> *), typeid(clbind::Derivable<T> *).name());
599-
SIMPLE_ERROR_SPRINTF("Could not convert %s of RTTI type %s to %s", _rep_(go).c_str(), typeid(o).name(), typeid(T*).name());
599+
SIMPLE_ERROR("Could not convert {} of RTTI type {} to {}", _rep_(go), typeid(o).name(), typeid(T*).name());
600600
} else {
601601
printf("%s:%d Can't handle object\n", __FILE__, __LINE__ );
602602
}
@@ -629,9 +629,9 @@ struct from_object<T *> {
629629
std::string demangled;
630630
bool success = core::maybe_demangle(expectedType,demangled);
631631
if (success) {
632-
SIMPLE_ERROR(("Incorrect object %s passed to function - expected type %s") , _rep_(o).c_str() , demangled);
632+
SIMPLE_ERROR("Incorrect object {} passed to function - expected type {}", _rep_(o).c_str() , demangled);
633633
} else {
634-
SIMPLE_ERROR(("Incorrect object %s passed to function - expected type %s") , _rep_(o).c_str() , typeid(T).name());
634+
SIMPLE_ERROR("Incorrect object {} passed to function - expected type {}", _rep_(o).c_str() , typeid(T).name());
635635
}
636636
}
637637
ASSERT(v_alien);
@@ -663,7 +663,7 @@ struct from_object<const T *&> {
663663
} else if ( core::General_sp gp = o.asOrNull<core::General_O>() ) {
664664
// What do I do here?
665665
}
666-
SIMPLE_ERROR_SPRINTF("Could not convert %s of RTTI type %s to %s", _rep_(o).c_str(), typeid(o).name(), typeid(T *&).name());
666+
SIMPLE_ERROR("Could not convert {} of RTTI type {} to {}", _rep_(o).c_str(), typeid(o).name(), typeid(T *&).name());
667667
}
668668
};
669669

@@ -687,7 +687,7 @@ T& safe_deref(T* ptr) {
687687
if (ptr) {
688688
return *ptr;
689689
}
690-
SIMPLE_ERROR(("Passing NULL to a from_object that dereferences - this probably means that NIL was passed to a clbind wrapped function that expects a real object"));
690+
SIMPLE_ERROR("Passing NULL to a from_object that dereferences - this probably means that NIL was passed to a clbind wrapped function that expects a real object");
691691
}
692692

693693
template <typename T>

include/clasp/clbind/constructor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class DerivableDefaultConstructorFunctor : public core::Function_O {
147147
virtual size_t templatedSizeof() const { return sizeof(*this); };
148148
public:
149149
static inline LCC_RETURN LISP_CALLING_CONVENTION() {
150-
SIMPLE_ERROR_SPRINTF("What do we do when this is called?");
150+
SIMPLE_ERROR("What do we do when this is called?");
151151
}
152152
static inline LISP_ENTRY_0() {
153153
return entry_point_n(lcc_closure,0,NULL);

include/clasp/clbind/enum_maker.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ struct enum_ : public enum_base {
144144
this->_v = converter->enumForSymbol<_ENUM_TYPE_>(sym); \
145145
return; \
146146
} \
147-
SIMPLE_ERROR_SPRINTF("Cannot convert object %s to " #_ENUM_TYPE_, _rep_(object).c_str()); \
147+
SIMPLE_ERROR("Cannot convert object {} to " #_ENUM_TYPE_, _rep_(object)); \
148148
} \
149149
}; \
150150
template <> struct to_object<_ENUM_TYPE_> { \

include/clasp/clbind/wrapped_iterator.h

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
/*
66
Copyright (c) 2014, Christian E. Schafmeister
7-
7+
88
CLASP is free software; you can redistribute it and/or
99
modify it under the terms of the GNU Library General Public
1010
License as published by the Free Software Foundation; either
1111
version 2 of the License, or (at your option) any later version.
12-
12+
1313
See directory 'clasp/licenses' for full details.
14-
14+
1515
The above copyright notice and this permission notice shall be included in
1616
all copies or substantial portions of the Software.
1717
@@ -43,38 +43,38 @@ class Iterator : public core::Iterator_O /*, public gctools::GC_MergeKinds */ {
4343
IT _Iterator;
4444
// End _end;
4545
public:
46-
Iterator(IT it /*, End end */) : _Iterator(it) /* , _end(end) */ {};
46+
Iterator(IT it /*, End end */) : _Iterator(it) /* , _end(end) */ {};
4747

48-
core::T_sp unsafeElement() const {
49-
return translate::to_object<IT>::convert(this->_Iterator);
50-
}
48+
core::T_sp unsafeElement() const { return translate::to_object<IT>::convert(this->_Iterator); }
5149
size_t templatedSizeof() const { return sizeof(*this); };
5250
void step() { ++this->_Iterator; };
53-
size_t distance(core::T_sp other) const {
51+
size_t distance(core::T_sp other) const {
5452
if (gctools::smart_ptr<Iterator> io = other.asOrNull<Iterator<IT>>()) {
55-
IT& otherIterator = io.get()->_Iterator;
56-
return std::distance(this->_Iterator,otherIterator);
53+
IT &otherIterator = io.get()->_Iterator;
54+
return std::distance(this->_Iterator, otherIterator);
5755
}
58-
SIMPLE_ERROR(("You tried to compare an iterator %s to an object %s of class %s and the isA relationship failed") , _rep_(this->asSmartPtr()) , _rep_(other) , _rep_(core::instance_class(other)));
56+
SIMPLE_ERROR("You tried to compare an iterator {} to an object {} of class %s and the isA relationship failed",
57+
_rep_(this->asSmartPtr()), _rep_(other), _rep_(core::instance_class(other)));
5958
}
60-
bool operator==(core::T_sp other) const {
59+
bool operator==(core::T_sp other) const {
6160
if (gctools::smart_ptr<Iterator> io = other.asOrNull<Iterator<IT>>()) {
62-
IT& otherIterator = io->_Iterator;
63-
return this->_Iterator == otherIterator;
61+
IT &otherIterator = io->_Iterator;
62+
return this->_Iterator == otherIterator;
6463
}
65-
SIMPLE_ERROR(("You tried to compare an iterator %s to an object %s of class %s and the isA relationship failed") , _rep_(this->asSmartPtr()) , _rep_(other) , _rep_(core::instance_class(other)));
64+
SIMPLE_ERROR("You tried to compare an iterator {} to an object {} of class {} and the isA relationship failed",
65+
_rep_(this->asSmartPtr()), _rep_(other), _rep_(core::instance_class(other)));
6666
}
6767
bool operator<(core::T_sp other) {
6868
if (Iterator<IT> *io = gc::As<gc::smart_ptr<Iterator<IT>>>(other)) {
69-
return this->_Iterator < (*io)._Iterator;
69+
return this->_Iterator < (*io)._Iterator;
7070
}
71-
SIMPLE_ERROR(("You tried to compare an iterator %s to an object %s of class %s and the isA relationship failed") , _rep_(this->asSmartPtr()) , _rep_(other) , _rep_(core::instance_class(other)));
71+
SIMPLE_ERROR("You tried to compare an iterator {} to an object {} of class {} and the isA relationship failed",
72+
_rep_(this->asSmartPtr()), _rep_(other), _rep_(core::instance_class(other)));
7273
}
7374
};
74-
};
75+
}; // namespace clbind
7576

76-
template <typename IT, typename Policy>
77-
class gctools::GCStamp<clbind::Iterator<IT, Policy>> {
77+
template <typename IT, typename Policy> class gctools::GCStamp<clbind::Iterator<IT, Policy>> {
7878
public:
7979
static gctools::GCStampEnum const StampWtag = gctools::GCStamp<typename clbind::Iterator<IT, Policy>::TemplatedBase>::StampWtag;
8080
};

include/clasp/core/bformat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ THE SOFTWARE.
3333
namespace core {
3434

3535
T_sp cl__format(T_sp dest, T_sp control, List_sp args);
36-
T_sp core__bformat(T_sp dest, const string &control, List_sp args);
36+
T_sp core__fmt(T_sp dest, const string &control, List_sp args);
3737
};
3838
#endif /* _bformat_H_ */

0 commit comments

Comments
 (0)