Explorar o código

Fix msys2 build error and warnings (#1009)

nanahi %!s(int64=2) %!d(string=hai) anos
pai
achega
2d3481c721
Modificáronse 2 ficheiros con 6 adicións e 1 borrados
  1. 1 0
      llama.cpp
  2. 5 1
      llama_util.h

+ 1 - 0
llama.cpp

@@ -9,6 +9,7 @@
 #include "ggml.h"
 
 #include <array>
+#include <ctime>
 #include <cinttypes>
 #include <fstream>
 #include <random>

+ 5 - 1
llama_util.h

@@ -43,8 +43,12 @@
     } while (0)
 
 #ifdef __GNUC__
+#ifdef __MINGW32__
+__attribute__((format(gnu_printf, 1, 2)))
+#else
 __attribute__((format(printf, 1, 2)))
 #endif
+#endif
 static std::string format(const char * fmt, ...) {
     va_list ap, ap2;
     va_start(ap, fmt);
@@ -57,7 +61,7 @@ static std::string format(const char * fmt, ...) {
     va_end(ap2);
     va_end(ap);
     return std::string(buf.data(), size);
-};
+}
 
 struct llama_file {
     // use FILE * so we don't have to re-open the file to mmap