diff options
author | László Langó <llango.u-szeged@partner.samsung.com> | 2016-02-18 11:34:51 +0000 |
---|---|---|
committer | László Langó <llango.u-szeged@partner.samsung.com> | 2016-02-19 15:45:14 +0100 |
commit | a0bedaa43df18d39adac52600557cccdf9f05968 (patch) | |
tree | 93a1ae8fed07f1580c6b09fb8d7533ca71b060de /jerry-libc | |
parent | b2edaafaa150fd973011e8770d6237be684d94dc (diff) |
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
Diffstat (limited to 'jerry-libc')
-rw-r--r-- | jerry-libc/include/ctype.h | 25 | ||||
-rw-r--r-- | jerry-libc/include/setjmp.h | 15 | ||||
-rw-r--r-- | jerry-libc/include/stdio.h | 35 | ||||
-rw-r--r-- | jerry-libc/include/stdlib.h | 20 | ||||
-rw-r--r-- | jerry-libc/include/string.h | 27 | ||||
-rw-r--r-- | jerry-libc/include/time.h | 10 | ||||
-rw-r--r-- | jerry-libc/jerry-libc.c | 1 | ||||
-rw-r--r-- | jerry-libc/target/darwin/jerry-libc-target.c | 1 | ||||
-rw-r--r-- | jerry-libc/target/linux/jerry-libc-target.c | 1 |
9 files changed, 60 insertions, 75 deletions
diff --git a/jerry-libc/include/ctype.h b/jerry-libc/include/ctype.h deleted file mode 100644 index 74990899..00000000 --- a/jerry-libc/include/ctype.h +++ /dev/null @@ -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 */ diff --git a/jerry-libc/include/setjmp.h b/jerry-libc/include/setjmp.h index 521b63df..62f56ea5 100644 --- a/jerry-libc/include/setjmp.h +++ b/jerry-libc/include/setjmp.h @@ -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 */ diff --git a/jerry-libc/include/stdio.h b/jerry-libc/include/stdio.h index fbef311d..dd3eeac0 100644 --- a/jerry-libc/include/stdio.h +++ b/jerry-libc/include/stdio.h @@ -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 */ diff --git a/jerry-libc/include/stdlib.h b/jerry-libc/include/stdlib.h index 0c3f2e5e..cc73ad44 100644 --- a/jerry-libc/include/stdlib.h +++ b/jerry-libc/include/stdlib.h @@ -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 */ diff --git a/jerry-libc/include/string.h b/jerry-libc/include/string.h index 5d3d6cd7..e9ff8c52 100644 --- a/jerry-libc/include/string.h +++ b/jerry-libc/include/string.h @@ -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 */ diff --git a/jerry-libc/include/time.h b/jerry-libc/include/time.h index b01e3d77..cf67368f 100644 --- a/jerry-libc/include/time.h +++ b/jerry-libc/include/time.h @@ -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 */ diff --git a/jerry-libc/jerry-libc.c b/jerry-libc/jerry-libc.c index 634dc164..e6d056c1 100644 --- a/jerry-libc/jerry-libc.c +++ b/jerry-libc/jerry-libc.c @@ -18,7 +18,6 @@ * Jerry libc's common functions implementation */ -#include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/jerry-libc/target/darwin/jerry-libc-target.c b/jerry-libc/target/darwin/jerry-libc-target.c index 02eaa6a0..f8a66bcd 100644 --- a/jerry-libc/target/darwin/jerry-libc-target.c +++ b/jerry-libc/target/darwin/jerry-libc-target.c @@ -18,7 +18,6 @@ * Jerry libc platform-specific functions darwin implementation */ -#include <ctype.h> #include <fcntl.h> #include <signal.h> #include <stdarg.h> diff --git a/jerry-libc/target/linux/jerry-libc-target.c b/jerry-libc/target/linux/jerry-libc-target.c index 67009d92..442c47a6 100644 --- a/jerry-libc/target/linux/jerry-libc-target.c +++ b/jerry-libc/target/linux/jerry-libc-target.c @@ -18,7 +18,6 @@ * Jerry libc platform-specific functions linux implementation */ -#include <ctype.h> #include <fcntl.h> #include <signal.h> #include <stdarg.h> |