[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] fix declarations
From: |
Mohammad-Reza Nabipoor |
Subject: |
[PATCH] fix declarations |
Date: |
Thu, 9 Dec 2021 03:13:11 +0330 |
* jitter/jitter-missing.h (flockfile): Add param.
(funlockfile): Likewise.
* templates/vm.h (enum vmprefix_exit_status): Put declaration
before the first use.
---
Hello, Luca.
I tried to use a jittery vm in a C++ program, the compiler complained
about these inconsistencies in header files.
This patch fix those problems.
But there's still a problem: The `restrict` keyword, which is a C99
keyword, not a C++ keyword.
So, I used the `vmprefix-vm.h` in my code like this:
```c++
extern "C" {
#define restrict
#include "vmprefix-vm.h"
}
```
But I think, it'd be nice if jitter handle this case.
For more info: https://gcc.gnu.org/onlinedocs/gcc/Restricted-Pointers.html
Regards,
Mohammad-Reza
jitter/jitter-missing.h | 4 +--
templates/vm.h | 60 ++++++++++++++++++++---------------------
2 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/jitter/jitter-missing.h b/jitter/jitter-missing.h
index 8e06e1a..3f4dd48 100644
--- a/jitter/jitter-missing.h
+++ b/jitter/jitter-missing.h
@@ -124,12 +124,12 @@
/* Do nothing. */
void
-flockfile ()
+flockfile (FILE *)
__attribute__ ((nonnull (1)));
/* Do nothing. */
void
-funlockfile ()
+funlockfile (FILE *)
__attribute__ ((nonnull (1)));
#endif // #ifndef JITTER_MISSING_H_
diff --git a/templates/vm.h b/templates/vm.h
index 532ebe6..405fde8 100644
--- a/templates/vm.h
+++ b/templates/vm.h
@@ -1125,6 +1125,36 @@ vmprefix_program_point;
+/* VM exit status.
+ * **************************************************************************
*/
+
+/* A value of this type is returned by a VM after execution, and the last
+ returned value is also held in the VM state in order to make consistency
+ checks. */
+enum vmprefix_exit_status
+ {
+ /* This state has never been used for execution. This is the initial value
+ within the state, and is never returned after execution. */
+ vmprefix_exit_status_never_executed = 0,
+
+ /* The state is being used in execution right now; this is never returned
by
+ the executor. It is an error (checked for) to execute code with a VM
+ state containing this exit status, which shows that there has been a
+ problem -- likely VM code was exited via longjmp, skipping the proper
+ cleanup. */
+ vmprefix_exit_status_being_executed = 1,
+
+ /* Some VM code has been executed. It is now possible to execute more code
+ (including the same code again) in the same state. */
+ vmprefix_exit_status_exited = 2,
+
+ /* Code execution has been interrupted for debugging, but can be resumed.
*/
+ vmprefix_exit_status_debug = 3,
+ };
+
+
+
+
/* Executing code from an executable routine.
* **************************************************************************
*/
@@ -1185,36 +1215,6 @@ vmprefix_execute_routine (jitter_routine r,
__attribute__ ((nonnull (1, 2)));
-
-
-/* VM exit status.
- * **************************************************************************
*/
-
-/* A value of this type is returned by a VM after execution, and the last
- returned value is also held in the VM state in order to make consistency
- checks. */
-enum vmprefix_exit_status
- {
- /* This state has never been used for execution. This is the initial value
- within the state, and is never returned after execution. */
- vmprefix_exit_status_never_executed = 0,
-
- /* The state is being used in execution right now; this is never returned
by
- the executor. It is an error (checked for) to execute code with a VM
- state containing this exit status, which shows that there has been a
- problem -- likely VM code was exited via longjmp, skipping the proper
- cleanup. */
- vmprefix_exit_status_being_executed = 1,
-
- /* Some VM code has been executed. It is now possible to execute more code
- (including the same code again) in the same state. */
- vmprefix_exit_status_exited = 2,
-
- /* Code execution has been interrupted for debugging, but can be resumed.
*/
- vmprefix_exit_status_debug = 3,
- };
-
-
/* Low-level debugging features relying on assembly: data locations.
--
2.34.1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] fix declarations,
Mohammad-Reza Nabipoor <=