aboutsummaryrefslogtreecommitdiff
path: root/tst/va_test.c
blob: 0413f997d74e117ea4bb70479c334150c1a9b1c8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>

/*
#define espik_debug_print (...) \
{ \
	va_list __ap; \
	char* __output; \
	__output = malloc (sizeof(char)* (strlen (__FUNCTION__", "__FILE__", "__LINE__" : ") + strlen(...))); \
	sprintf (__output, "%s: %s", __FUNCTION__", "__FILE__", "__LINE__" : ", ...); \
	va_start (__ap, __output); \
	vfprintf (stdout, __output, ap); \
	va_end (__ap); \
	free (__output); \
}
*/

#ifdef __GNUC__

#define espik_debug_print (fmt, ...) \
{ \
	fprintf (stdout, "%s, %s, %i: ", __FUNCTION__, __FILE__, __LINE__); \
	vfprintf (stdout, fmt, __VA_ARGS__); \
}

#endif	/* __GNUC__ */

int main()
{
	int a = 10;

	espik_debug_print ("a : %d\n", a);

	return (0);
}