[m-rev.] diff: Avoid SC_32 name collision in generated C code.

Peter Wang novalazy at gmail.com
Wed Apr 30 11:54:04 AEST 2025


On AIX, /usr/include/sys/mac.h contains the macros:

    #define SC_32 32
    #define SM_32 8

This can result in a name collision when we generate high-level C code
containing a variable named SC_32 or SM_32.

library/test_bitset.m:
    Rename a variable to avoid the name collision.

diff --git a/library/test_bitset.m b/library/test_bitset.m
index c7e47c962..0d2731c9b 100644
--- a/library/test_bitset.m
+++ b/library/test_bitset.m
@@ -2,7 +2,7 @@
 % vim: ft=mercury ts=4 sw=4 et
 %---------------------------------------------------------------------------%
 % Copyright (C) 2011-2012 The University of Melbourne.
-% Copyright (C) 2014-2015, 2018, 2024 The Mercury team.
+% Copyright (C) 2014-2015, 2018, 2024-2025 The Mercury team.
 % This file is distributed under the terms specified in COPYING.LIB.
 %---------------------------------------------------------------------------%
 %
@@ -569,13 +569,13 @@ remove_least(Least, In @ tb(SetA0, SetB0, SetC0, SetD0, SetS0), Result) :-
     ( if
         MaybeA = yes(LA - SA),
         MaybeB = yes(LB - SB),
-        MaybeC = yes(LC - SC),
+        MaybeC = yes(LC - Sc),  % avoid SC_32 macro on AIX
         MaybeD = yes(LD - SD),
         MaybeS = yes(LS - SS),
         LA = LS, LB = LS, LC = LS, LD = LS
     then
         Least = LS,
-        check1("remove_least", In, tb(SA, SB, SC, SD, SS), Result)
+        check1("remove_least", In, tb(SA, SB, Sc, SD, SS), Result)
     else if
         MaybeA = no,
         MaybeB = no,
-- 
2.49.0



More information about the reviews mailing list