sim/erc32: Rename EVENT_MAX -> MAX_EVENTS

Message ID 20240303102235.1264-1-orgad.shaneh@audiocodes.com
State New
Headers
Series sim/erc32: Rename EVENT_MAX -> MAX_EVENTS |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed

Commit Message

Orgad Shaneh March 3, 2024, 10:22 a.m. UTC
  From: Orgad Shaneh <orgads@gmail.com>

EVENT_MAX is defined as 0x7FFFFFFF (INT_MAX) in winuser.h, so when
building on Windows, the value is overridden and compilation fails
because the array size of evbuf is too large.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28476
---
 sim/erc32/func.c | 6 +++---
 sim/erc32/sis.h  | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
  

Comments

Tom Tromey March 8, 2024, 5:23 p.m. UTC | #1
>>>>> "Orgad" == Orgad Shaneh <orgads@gmail.com> writes:

Orgad> From: Orgad Shaneh <orgads@gmail.com>
Orgad> EVENT_MAX is defined as 0x7FFFFFFF (INT_MAX) in winuser.h, so when
Orgad> building on Windows, the value is overridden and compilation fails
Orgad> because the array size of evbuf is too large.

Orgad> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28476

Thanks.  I think this is ok.
Approved-By: Tom Tromey <tom@tromey.com>

Tom
  
Orgad Shaneh March 21, 2024, 6:37 a.m. UTC | #2
On Fri, Mar 8, 2024 at 7:23 PM Tom Tromey <tom@tromey.com> wrote:
>
> >>>>> "Orgad" == Orgad Shaneh <orgads@gmail.com> writes:
>
> Orgad> From: Orgad Shaneh <orgads@gmail.com>
> Orgad> EVENT_MAX is defined as 0x7FFFFFFF (INT_MAX) in winuser.h, so when
> Orgad> building on Windows, the value is overridden and compilation fails
> Orgad> because the array size of evbuf is too large.
>
> Orgad> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28476
>
> Thanks.  I think this is ok.
> Approved-By: Tom Tromey <tom@tromey.com>

Thank you. What's the next step for getting this merged?

- Orgad
  
Tom Tromey March 21, 2024, 4:49 p.m. UTC | #3
>>>>> "Orgad" == Orgad Shaneh <orgads@gmail.com> writes:

>> Thanks.  I think this is ok.
>> Approved-By: Tom Tromey <tom@tromey.com>

Orgad> Thank you. What's the next step for getting this merged?

I've pushed it.

Do you have a copyright assignment in place?  I think this patch is
small/obvious enough without one, but we'll need one at some point.
With an assignment you can also get write-after-approval access.

thanks,
Tom
  

Patch

diff --git a/sim/erc32/func.c b/sim/erc32/func.c
index 972a636e619..80f416d87d7 100644
--- a/sim/erc32/func.c
+++ b/sim/erc32/func.c
@@ -697,7 +697,7 @@  init_signals(void)
 extern struct disassemble_info dinfo;
 
 struct estate   ebase;
-struct evcell   evbuf[EVENT_MAX];
+struct evcell   evbuf[MAX_EVENTS];
 struct irqcell  irqarr[16];
 
 static int
@@ -864,10 +864,10 @@  init_event(void)
 
     ebase.eq.nxt = NULL;
     ebase.freeq = evbuf;
-    for (i = 0; i < EVENT_MAX; i++) {
+    for (i = 0; i < MAX_EVENTS; i++) {
 	evbuf[i].nxt = &evbuf[i + 1];
     }
-    evbuf[EVENT_MAX - 1].nxt = NULL;
+    evbuf[MAX_EVENTS - 1].nxt = NULL;
 }
 
 void
diff --git a/sim/erc32/sis.h b/sim/erc32/sis.h
index 504d7e69c77..cf44ddfb7fe 100644
--- a/sim/erc32/sis.h
+++ b/sim/erc32/sis.h
@@ -31,7 +31,7 @@ 
 #define I_ACC_EXC 1
 
 /* Maximum events in event queue */
-#define EVENT_MAX	256
+#define MAX_EVENTS	256
 
 /* Maximum # of floating point queue */
 #define FPUQN	1