Mail Archives: djgpp-workers/2001/02/08/17:38:01
Eli Zaretskii wrote:
> On Thu, 8 Feb 2001, Stephen Silver wrote:
>
> > 17.4.1.2 paragraph 5:
> >
> > Names which are defined as macros in C shall be defined as
> > macros in the C++ Standard Library, even if C grants license for
> > implementation as functions. [Note: the names defined as macros
> > in C include the following: assert, errno, offsetof, setjmp,
> > va_arg, va_end, and va_start. —end note]
>
> This seems to indicate that setjmp should be a macro in C as well.
> perhaps we need to make "#define setjmp setjmp" be visible even outside
> #ifdef __cplusplus.
It's not absolutely necessary to do this in C, as C does permit a
non-macro implemention. But it's harmless, so I've done it this way.
The following patch is the same as the original one, except for
adding one extra line.
Stephen
*** include/setjmp.h.old Thu Jun 3 17:22:28 1999
--- include/setjmp.h Thu Feb 8 18:29:28 2001
***************
*** 5,8 ****
--- 5,9 ----
#ifdef __cplusplus
+ namespace std {
extern "C" {
#endif
***************
*** 22,25 ****
--- 23,27 ----
void longjmp(jmp_buf env, int val);
int setjmp(jmp_buf env);
+ #define setjmp setjmp /* required by C++ standard */
#ifndef __STRICT_ANSI__
***************
*** 41,45 ****
--- 43,68 ----
#ifdef __cplusplus
}
+ }
#endif
#endif /* !__dj_include_setjmp_h_ */
+
+
+ #if defined(__cplusplus) && !defined(__dj_ENFORCE_ANSI_FREESTANDING)
+
+ using std::setjmp;
+
+ #ifndef __dj_via_cplusplus_header_
+
+ using std::longjmp;
+ using std::jmp_buf;
+
+ #ifndef __STRICT_ANSI__
+
+ using std::sigjmp_buf;
+ using std::sigsetjmp;
+ using std::siglongjmp;
+
+ #endif /* !__STRICT_ANSI__ */
+ #endif /* !__dj_via_cplusplus_header_ */
+ #endif /* __cplusplus && !__dj_ENFORCE_ANSI_FREESTANDING */
- Raw text -