Skip to content

Commit e544eaf

Browse files
committed
Clean up warnings and unused parameters.
1 parent f516bfd commit e544eaf

File tree

4 files changed

+24
-19
lines changed

4 files changed

+24
-19
lines changed

Makefile

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
# Check if a default C++ compiler exists, otherwise use g++
22
CXX ?= g++
3+
CXXFLAGS = -Wall -Wextra -Wpedantic
4+
5+
CREATE_BUILD_DIR = mkdir -p build; cp -n llama.jpg build;
36

47
all: examples test-cpp11 test-cpp14 test-cpp20
58
examples: examples/main.cpp
6-
mkdir -p build
7-
$(CXX) examples/main.cpp -Iinclude -o build/examples -std=c++11 -pthread -latomic
9+
$(CREATE_BUILD_DIR)
10+
$(CXX) $(CXXFLAGS) examples/main.cpp -Iinclude -o build/examples -std=c++11 -pthread -latomic
811
test: test-cpp11
912
test-cpp11: test/test.cpp
10-
mkdir -p build
11-
$(CXX) test/test.cpp -Iinclude -Itest -o build/test -std=c++11 -pthread -latomic
13+
$(CREATE_BUILD_DIR)
14+
$(CXX) $(CXXFLAGS) test/test.cpp -Iinclude -Itest -o build/test -std=c++11 -pthread -latomic
1215
test-cpp14: test/test.cpp
13-
mkdir -p build
14-
$(CXX) test/test.cpp -Iinclude -Itest -o build/test-cpp14 -std=c++14 -pthread -latomic
16+
$(CREATE_BUILD_DIR)
17+
$(CXX) $(CXXFLAGS) test/test.cpp -Iinclude -Itest -o build/test-cpp14 -std=c++14 -pthread -latomic
1518
test-cpp20: test/test.cpp
16-
mkdir -p build
17-
$(CXX) test/test.cpp -Iinclude -Itest -o build/test-cpp20 -std=c++2a -pthread -latomic
19+
$(CREATE_BUILD_DIR)
20+
$(CXX) $(CXXFLAGS) test/test.cpp -Iinclude -Itest -o build/test-cpp20 -std=c++2a -pthread -latomic
1821
clean:
1922
rm -rf build

include/ollama.hpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ namespace ollama
101101
public:
102102
image(const std::string base64_sequence, bool valid = true)
103103
{
104-
this->base64_sequence = base64_sequence;
104+
this->base64_sequence = base64_sequence; this->valid = valid;
105105
}
106106
~image(){};
107107

@@ -254,7 +254,7 @@ namespace ollama
254254
(*this)["stream"] = stream;
255255

256256
if (options!=nullptr) (*this)["options"] = options["options"];
257-
//(*this)["format"] = format; // Commented out as providing the format causes issues with some models.
257+
(void)format; //(*this)["format"] = format; // Commented out as providing the format causes issues with some models.
258258
(*this)["keep_alive"] = keep_alive_duration;
259259
type = message_type::chat;
260260

@@ -329,7 +329,7 @@ namespace ollama
329329
return simple_string;
330330
}
331331

332-
const bool has_error() const
332+
bool has_error() const
333333
{
334334
if ( json_data.contains("error") ) return true;
335335
return false;
@@ -871,12 +871,13 @@ class Ollama
871871

872872
private:
873873

874+
/*
874875
bool send_request(const ollama::request& request, std::function<void(const ollama::response&)> on_receive_response=nullptr)
875876
{
876877
877878
return true;
878879
}
879-
880+
*/
880881

881882
std::string server_url;
882883
httplib::Client *cli;
@@ -1039,7 +1040,7 @@ namespace ollama
10391040
ollama.setWriteTimeout(seconds);
10401041
}
10411042

1042-
};
1043+
}
10431044

10441045

10451046
#endif

singleheader/ollama.hpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -34891,7 +34891,7 @@ namespace ollama
3489134891
public:
3489234892
image(const std::string base64_sequence, bool valid = true)
3489334893
{
34894-
this->base64_sequence = base64_sequence;
34894+
this->base64_sequence = base64_sequence; this->valid = valid;
3489534895
}
3489634896
~image(){};
3489734897

@@ -35044,7 +35044,7 @@ namespace ollama
3504435044
(*this)["stream"] = stream;
3504535045

3504635046
if (options!=nullptr) (*this)["options"] = options["options"];
35047-
//(*this)["format"] = format; // Commented out as providing the format causes issues with some models.
35047+
(void)format; //(*this)["format"] = format; // Commented out as providing the format causes issues with some models.
3504835048
(*this)["keep_alive"] = keep_alive_duration;
3504935049
type = message_type::chat;
3505035050

@@ -35119,7 +35119,7 @@ namespace ollama
3511935119
return simple_string;
3512035120
}
3512135121

35122-
const bool has_error() const
35122+
bool has_error() const
3512335123
{
3512435124
if ( json_data.contains("error") ) return true;
3512535125
return false;
@@ -35661,12 +35661,13 @@ class Ollama
3566135661

3566235662
private:
3566335663

35664+
/*
3566435665
bool send_request(const ollama::request& request, std::function<void(const ollama::response&)> on_receive_response=nullptr)
3566535666
{
3566635667

3566735668
return true;
3566835669
}
35669-
35670+
*/
3567035671

3567135672
std::string server_url;
3567235673
httplib::Client *cli;
@@ -35829,7 +35830,7 @@ namespace ollama
3582935830
ollama.setWriteTimeout(seconds);
3583035831
}
3583135832

35832-
};
35833+
}
3583335834

3583435835

3583535836
#endif

test/test.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ TEST_SUITE("Ollama Tests") {
106106
try {
107107
ollama::generate("Non-existent-model", "Requesting this model will throw an error");
108108
}
109-
catch(ollama::exception e) { exception_handled = true; }
109+
catch(ollama::exception& e) { exception_handled = true; }
110110

111111
CHECK( exception_handled );
112112
}

0 commit comments

Comments
 (0)