Check _XOPEN_SOURCE macro before defining (#2220)

In jrt.h the _XOPEN_SOURCE macro is defined.
However if the compiler already specifies this as
a default define, it can lead to compiler warnings
or errors.

By adding a macro check the warnings/errors can be
avoided.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
This commit is contained in:
Péter Gál 2018-03-02 02:17:25 +01:00 committed by yichoi
parent d60d4dbba9
commit 575ec7e10a

View File

@ -16,8 +16,11 @@
#ifndef JRT_H
#define JRT_H
#if !defined (_XOPEN_SOURCE) || _XOPEN_SOURCE < 500
#undef _XOPEN_SOURCE
/* Required macro for sleep functions (nanosleep or usleep) */
#define _XOPEN_SOURCE 500
#endif
#include <stdio.h>
#include <string.h>