Skip to content

[libc] Change RPC opcode enum definition #67439

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 26, 2023
Merged

[libc] Change RPC opcode enum definition #67439

merged 1 commit into from
Sep 26, 2023

Conversation

jhuber6
Copy link
Contributor

@jhuber6 jhuber6 commented Sep 26, 2023

Summary:
This enum previously manually specified the value. This just made it
unnecessarily difficult to add new ones without changing everything.
This patch also makes it compatible with C by removing the :
annotation and instead using the LAST method.

Summary:
This enum previously manually specified the value. This just made it
unnecessarily difficult to add new ones without changing everything.
This patch also makes it compatible with C by removing the `:`
annotation and instead using the `LAST` method.
@llvmbot
Copy link
Member

llvmbot commented Sep 26, 2023

@llvm/pr-subscribers-libc

Changes

Summary:
This enum previously manually specified the value. This just made it
unnecessarily difficult to add new ones without changing everything.
This patch also makes it compatible with C by removing the :
annotation and instead using the LAST method.


Full diff: https://github.com/llvm/llvm-project/pull/67439.diff

1 Files Affected:

  • (modified) libc/include/llvm-libc-types/rpc_opcodes_t.h (+20-19)
diff --git a/libc/include/llvm-libc-types/rpc_opcodes_t.h b/libc/include/llvm-libc-types/rpc_opcodes_t.h
index 77fa709466974d7..61e17756fa64776 100644
--- a/libc/include/llvm-libc-types/rpc_opcodes_t.h
+++ b/libc/include/llvm-libc-types/rpc_opcodes_t.h
@@ -9,26 +9,27 @@
 #ifndef __LLVM_LIBC_TYPES_RPC_OPCODE_H__
 #define __LLVM_LIBC_TYPES_RPC_OPCODE_H__
 
-typedef enum : unsigned short {
+typedef enum {
   RPC_NOOP = 0,
-  RPC_EXIT = 1,
-  RPC_WRITE_TO_STDOUT = 2,
-  RPC_WRITE_TO_STDERR = 3,
-  RPC_WRITE_TO_STREAM = 4,
-  RPC_WRITE_TO_STDOUT_NEWLINE = 5,
-  RPC_READ_FROM_STREAM = 6,
-  RPC_OPEN_FILE = 7,
-  RPC_CLOSE_FILE = 8,
-  RPC_MALLOC = 9,
-  RPC_FREE = 10,
-  RPC_HOST_CALL = 11,
-  RPC_ABORT = 12,
-  RPC_FEOF = 13,
-  RPC_FERROR = 14,
-  RPC_CLEARERR = 15,
-  RPC_FSEEK = 16,
-  RPC_FTELL = 17,
-  RPC_FFLUSH = 18,
+  RPC_EXIT,
+  RPC_WRITE_TO_STDOUT,
+  RPC_WRITE_TO_STDERR,
+  RPC_WRITE_TO_STREAM,
+  RPC_WRITE_TO_STDOUT_NEWLINE,
+  RPC_READ_FROM_STREAM,
+  RPC_OPEN_FILE,
+  RPC_CLOSE_FILE,
+  RPC_MALLOC,
+  RPC_FREE,
+  RPC_HOST_CALL,
+  RPC_ABORT,
+  RPC_FEOF,
+  RPC_FERROR,
+  RPC_CLEARERR,
+  RPC_FSEEK,
+  RPC_FTELL,
+  RPC_FFLUSH,
+  RPC_LAST = 0xFFFF,
 } rpc_opcode_t;
 
 #endif // __LLVM_LIBC_TYPES_RPC_OPCODE_H__

@jhuber6 jhuber6 merged commit 6273b6d into llvm:main Sep 26, 2023
legrosbuffle pushed a commit to legrosbuffle/llvm-project that referenced this pull request Sep 29, 2023
Summary:
This enum previously manually specified the value. This just made it
unnecessarily difficult to add new ones without changing everything.
This patch also makes it compatible with C by removing the `:`
annotation and instead using the `LAST` method.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants