Remove EXTERN_C macros and use block based solution

Related issue: #900

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
This commit is contained in:
László Langó
2016-02-18 11:34:51 +00:00
parent b2edaafaa1
commit a0bedaa43d
14 changed files with 140 additions and 206 deletions
-25
View File
@@ -1,25 +0,0 @@
/* Copyright 2015 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef JERRY_LIBC_CTYPE_H
#define JERRY_LIBC_CTYPE_H
#ifdef __cplusplus
# define EXTERN_C "C"
#else /* !__cplusplus */
# define EXTERN_C
#endif /* !__cplusplus */
#endif /* !JERRY_LIBC_CTYPE_H */
+9 -6
View File
@@ -1,4 +1,5 @@
/* Copyright 2015 Samsung Electronics Co., Ltd.
/* Copyright 2015-2016 Samsung Electronics Co., Ltd.
* Copyright 2016 University of Szeged.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,9 +20,8 @@
#include <stdint.h>
#ifdef __cplusplus
# define EXTERN_C "C"
#else /* !__cplusplus */
# define EXTERN_C
extern "C"
{
#endif /* !__cplusplus */
/**
@@ -56,7 +56,10 @@
*/
typedef uint64_t jmp_buf[14];
extern EXTERN_C int setjmp (jmp_buf env);
extern EXTERN_C void longjmp (jmp_buf env, int val);
int setjmp (jmp_buf env);
void longjmp (jmp_buf env, int val);
#ifdef __cplusplus
}
#endif /* !__cplusplus */
#endif /* !JERRY_LIBC_SETJMP_H */
+19 -16
View File
@@ -1,4 +1,5 @@
/* Copyright 2015 Samsung Electronics Co., Ltd.
/* Copyright 2015-2016 Samsung Electronics Co., Ltd.
* Copyright 2016 University of Szeged.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,9 +21,8 @@
#include <stddef.h>
#ifdef __cplusplus
# define EXTERN_C "C"
#else /* !__cplusplus */
# define EXTERN_C
extern "C"
{
#endif /* !__cplusplus */
/**
@@ -47,17 +47,20 @@ extern FILE *stderr;
/**
* I/O routines
*/
extern EXTERN_C int vfprintf (FILE *stream, const char *format, va_list ap);
extern EXTERN_C int puts (const char *s);
extern EXTERN_C FILE *fopen (const char *path, const char *mode);
extern EXTERN_C int fclose (FILE *fp);
extern EXTERN_C size_t fread (void *ptr, size_t size, size_t nmemb, FILE *stream);
extern EXTERN_C size_t fwrite (const void *ptr, size_t size, size_t nmemb, FILE *stream);
extern EXTERN_C int fseek (FILE *stream, long offset, int whence);
extern EXTERN_C long ftell (FILE *stream);
extern EXTERN_C int printf (const char *format, ...);
extern EXTERN_C void rewind (FILE *stream);
extern EXTERN_C int fprintf (FILE *stream, const char *format, ...);
extern EXTERN_C int putchar (int c);
int vfprintf (FILE *stream, const char *format, va_list ap);
int puts (const char *s);
FILE *fopen (const char *path, const char *mode);
int fclose (FILE *fp);
size_t fread (void *ptr, size_t size, size_t nmemb, FILE *stream);
size_t fwrite (const void *ptr, size_t size, size_t nmemb, FILE *stream);
int fseek (FILE *stream, long offset, int whence);
long ftell (FILE *stream);
int printf (const char *format, ...);
void rewind (FILE *stream);
int fprintf (FILE *stream, const char *format, ...);
int putchar (int c);
#ifdef __cplusplus
}
#endif /* !__cplusplus */
#endif /* !JERRY_LIBC_STDIO_H */
+11 -9
View File
@@ -1,4 +1,5 @@
/* Copyright 2015 Samsung Electronics Co., Ltd.
/* Copyright 2015-2016 Samsung Electronics Co., Ltd.
* Copyright 2016 University of Szeged.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,14 +18,10 @@
#define JERRY_LIBC_STDLIB_H
#ifdef __cplusplus
# define EXTERN_C "C"
#else /* !__cplusplus */
# define EXTERN_C
extern "C"
{
#endif /* !__cplusplus */
extern EXTERN_C void __attribute__ ((noreturn)) exit (int);
extern EXTERN_C void __attribute__ ((noreturn)) abort (void);
/**
* Maximum integer that could be returned by random number generator
*
@@ -33,7 +30,12 @@ extern EXTERN_C void __attribute__ ((noreturn)) abort (void);
*/
#define RAND_MAX (0x7fffffffu)
extern EXTERN_C int rand (void);
extern EXTERN_C void srand (unsigned int);
void __attribute__ ((noreturn)) exit (int);
void __attribute__ ((noreturn)) abort (void);
int rand (void);
void srand (unsigned int);
#ifdef __cplusplus
}
#endif /* !__cplusplus */
#endif /* !JERRY_LIBC_STDLIB_H */
+15 -12
View File
@@ -1,4 +1,5 @@
/* Copyright 2015 Samsung Electronics Co., Ltd.
/* Copyright 2015-2016 Samsung Electronics Co., Ltd.
* Copyright 2016 University of Szeged.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,18 +20,20 @@
#include <stddef.h>
#ifdef __cplusplus
# define EXTERN_C "C"
#else /* !__cplusplus */
# define EXTERN_C
extern "C"
{
#endif /* !__cplusplus */
extern EXTERN_C int memcmp (const void *s1, const void *s2, size_t n);
extern EXTERN_C void* memcpy (void *dest, const void *src, size_t n);
extern EXTERN_C void* memset (void *s, int c, size_t n);
extern EXTERN_C int strcmp (const char *s1, const char *s2);
extern EXTERN_C size_t strlen (const char *s);
extern EXTERN_C void* memmove (void *dest, const void *src, size_t n);
extern EXTERN_C int strncmp (const char *s1, const char *s2, size_t n);
extern EXTERN_C char* strncpy (char *dest, const char *src, size_t n);
void *memcpy (void *dest, const void *src, size_t n);
void *memset (void *s, int c, size_t n);
void *memmove (void *dest, const void *src, size_t n);
int memcmp (const void *s1, const void *s2, size_t n);
int strcmp (const char *s1, const char *s2);
int strncmp (const char *s1, const char *s2, size_t n);
char *strncpy (char *dest, const char *src, size_t n);
size_t strlen (const char *s);
#ifdef __cplusplus
}
#endif /* !__cplusplus */
#endif /* !JERRY_LIBC_STRING_H */
+6 -4
View File
@@ -18,9 +18,8 @@
#define JERRY_LIBC_TIME_H
#ifdef __cplusplus
# define EXTERN_C "C"
#else /* !__cplusplus */
# define EXTERN_C
extern "C"
{
#endif /* !__cplusplus */
/**
@@ -41,6 +40,9 @@ struct timezone
int tz_dsttime; /**< type of DST correction */
};
extern EXTERN_C int gettimeofday (void *tp, void *tzp);
int gettimeofday (void *tp, void *tzp);
#ifdef __cplusplus
}
#endif /* !__cplusplus */
#endif /* !JERRY_LIBC_TIME_H */