Dear GCC Patches Team, I hope this message finds you well.
I am submitting a patch for the GCC compiler's "stdbool.h" to optimize the size of the true and false macros in the C programming language. Currently, the size of the true and false macros is 4 bytes, whereas the _Bool datatype is 1 byte in size. This patch proposes a change that will set the size of the true and false macros to 1 byte, aligning them more closely with the _Bool datatype. The implementation is simple and should result in a minor but beneficial optimization for memory usage in certain scenarios. Please find the patch attached for review. The changes are made in Line 37 and 38. I look forward to your feedback and would be happy to make any necessary adjustments. Best regards, Saksham Joshi [LinkedIn: @sakshamjoshi27]
/* Copyright (C) 1998-2025 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Under Section 7 of GPL version 3, you are granted additional permissions described in the GCC Runtime Library Exception, version 3.1, as published by the Free Software Foundation. You should have received a copy of the GNU General Public License and a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ /* * ISO C Standard: 7.16 Boolean type and values <stdbool.h> */ #ifndef _STDBOOL_H #define _STDBOOL_H #ifndef __cplusplus #if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L /* bool, true and false are keywords. */ #else #define bool _Bool #define true (bool) 1 #define false (bool) 0 #endif #else /* __cplusplus */ /* Supporting _Bool in C++ is a GCC extension. */ #define _Bool bool #endif /* __cplusplus */ /* Signal that all the definitions are present. */ #define __bool_true_false_are_defined 1 #endif /* stdbool.h */