mirror of
https://github.com/YosysHQ/yosys.git
synced 2026-08-22 06:07:26 +02:00
Fixed log so it will compile under Visual Studio
- Included an implementation of gettimeofday
This commit is contained in:
committed by
Clifford Wolf
parent
fad0b0c506
commit
0352dbfd65
+24
-1
@@ -21,7 +21,10 @@
|
|||||||
#include "libs/sha1/sha1.h"
|
#include "libs/sha1/sha1.h"
|
||||||
#include "backends/ilang/ilang_backend.h"
|
#include "backends/ilang/ilang_backend.h"
|
||||||
|
|
||||||
#include <sys/time.h>
|
#ifndef _WIN32
|
||||||
|
#include <sys/time.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -48,6 +51,26 @@ static struct timeval initial_tv = { 0, 0 };
|
|||||||
static bool next_print_log = false;
|
static bool next_print_log = false;
|
||||||
static int log_newline_count = 0;
|
static int log_newline_count = 0;
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
// this will get time information and return it in timeval, simulating gettimeofday()
|
||||||
|
int gettimeofday(struct timeval *tv, struct timezone *tz)
|
||||||
|
{
|
||||||
|
LARGE_INTEGER counter;
|
||||||
|
LARGE_INTEGER freq;
|
||||||
|
|
||||||
|
QueryPerformanceFrequency(&freq);
|
||||||
|
QueryPerformanceCounter(&counter);
|
||||||
|
|
||||||
|
counter.QuadPart *= 1000000;
|
||||||
|
counter.QuadPart /= freq.QuadPart;
|
||||||
|
|
||||||
|
tv->tv_sec = counter.QuadPart / 1000000;
|
||||||
|
tv->tv_usec = counter.QuadPart % 1000000;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void logv(const char *format, va_list ap)
|
void logv(const char *format, va_list ap)
|
||||||
{
|
{
|
||||||
while (format[0] == '\n' && format[1] != 0) {
|
while (format[0] == '\n' && format[1] != 0) {
|
||||||
|
|||||||
+15
-7
@@ -23,10 +23,10 @@
|
|||||||
#define LOG_H
|
#define LOG_H
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
# include <sys/resource.h>
|
#include <sys/time.h>
|
||||||
|
#include <sys/resource.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// from libs/sha1/sha1.h
|
// from libs/sha1/sha1.h
|
||||||
@@ -51,12 +51,20 @@ extern int log_verbose_level;
|
|||||||
|
|
||||||
void logv(const char *format, va_list ap);
|
void logv(const char *format, va_list ap);
|
||||||
void logv_header(const char *format, va_list ap);
|
void logv_header(const char *format, va_list ap);
|
||||||
void logv_error(const char *format, va_list ap) __attribute__ ((noreturn));
|
|
||||||
|
|
||||||
void log(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
|
#if !defined(__GNUC__) && !defined(__clang__)
|
||||||
void log_header(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
|
void logv_error(const char *format, va_list ap);
|
||||||
void log_error(const char *format, ...) __attribute__ ((format (printf, 1, 2))) __attribute__ ((noreturn));
|
void log(const char *format, ...);
|
||||||
void log_cmd_error(const char *format, ...) __attribute__ ((format (printf, 1, 2))) __attribute__ ((noreturn));
|
void log_header(const char *format, ...);
|
||||||
|
void log_error(const char *format, ...);
|
||||||
|
void log_cmd_error(const char *format, ...);
|
||||||
|
#else
|
||||||
|
void logv_error(const char *format, va_list ap) __attribute__((noreturn));
|
||||||
|
void log(const char *format, ...) __attribute__((format(printf, 1, 2)));
|
||||||
|
void log_header(const char *format, ...) __attribute__((format(printf, 1, 2)));
|
||||||
|
void log_error(const char *format, ...) __attribute__((format(printf, 1, 2))) __attribute__((noreturn));
|
||||||
|
void log_cmd_error(const char *format, ...) __attribute__((format(printf, 1, 2))) __attribute__((noreturn));
|
||||||
|
#endif
|
||||||
|
|
||||||
void log_spacer();
|
void log_spacer();
|
||||||
void log_push();
|
void log_push();
|
||||||
|
|||||||
Reference in New Issue
Block a user