GCC modified for the FreeChainXenon project
![]() When warning about length-check failures detected at compile time that are flagged with "too few elements" or "too many elements", the compiler now gives an additional message indicating the number of elements expected by the context versus how many are present in the conflicting expression (such as an aggregate that has too few or too many components). The test below reports the following warnings when compiled with this command: $ gcc -c -gnatj78 length_warnings.adb length_warnings.adb:6:09: warning: too few elements for subtype of "Boolean_Array" defined at line 5, expected 10 elements; found 9 elements, "Constraint_Error" will be raised at run time length_warnings.adb:10:09: warning: too few elements for subtype of "Boolean_Array" defined at line 9, expected 2 elements; found 1 element, "Constraint_Error" will be raised at run time length_warnings.adb:14:09: warning: too many elements for subtype of "Boolean_Array" defined at line 13, expected 10 elements; found 11 elements, "Constraint_Error" will be raised at run time length_warnings.adb:18:09: warning: too many elements for subtype of "Boolean_Array" defined at line 17, expected 0 elements; found 1 element, "Constraint_Error" will be raised at run time length_warnings.adb:22:09: warning: too many elements for subtype of "Boolean_Array" defined at line 21, expected 1 element; found 2 elements, "Constraint_Error" will be raised at run time procedure Length_Check_Warnings is type Boolean_Array is array (Natural range <>) of Boolean; Bits_A : Boolean_Array (1 .. 10) := (True, True, True, True, True, True, True, True, True); -- Too few elements Bits_B : Boolean_Array (1 .. 2) := (1 => False); -- Too few elements Bits_C : Boolean_Array (1 .. 10) := (True, True, True, True, True, True, True, True, True, True, True); -- Too many elements Bits_D : Boolean_Array (1 .. 0) := (1 => True); -- Too many elements Bits_E : Boolean_Array (1 .. 1) := (True, False); -- Too many elements begin null; end Length_Check_Warnings; 2019-08-19 Gary Dismukes <dismukes@adacore.com> gcc/ada/ * checks.adb (Length_Mismatch_Info_Message): New function in Selected_Length_Checks to return a message indicating the element counts for the mismatched lengths for a failed compile-time length check. (Plural_Or_Singular_Ending): Support function in Length_Mismatch_Info_Message to return either "" or "s", for concatenating to the end of words. (Selected_Length_Checks): Pass the result of Length_Mismatch_Info_Message as an extra warning message to Compile_Time_Constraint_Error to indicate the mismatched lengths for a failed compile-time length check. * sem_util.ads (Compile_Time_Constraint_Error): Add an optional message formal (Extra_Msg), defaulted to the empty string. * sem_util.adb (Compile_Time_Constraint_Error): Output an extra message following the main warning message (when Extra_Msg is not the empty string). From-SVN: r274652 |
||
---|---|---|
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
gotools | ||
include | ||
INSTALL | ||
intl | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcc1 | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgfortran | ||
libgo | ||
libgomp | ||
libhsail-rt | ||
libiberty | ||
libitm | ||
libobjc | ||
liboffloadmic | ||
libphobos | ||
libquadmath | ||
libsanitizer | ||
libssp | ||
libstdc++-v3 | ||
libvtv | ||
lto-plugin | ||
maintainer-scripts | ||
zlib | ||
.dir-locals.el | ||
.gitattributes | ||
.gitignore | ||
ABOUT-NLS | ||
ar-lib | ||
ChangeLog | ||
ChangeLog.jit | ||
ChangeLog.tree-ssa | ||
compile | ||
config-ml.in | ||
config.guess | ||
config.rpath | ||
config.sub | ||
configure | ||
configure.ac | ||
COPYING | ||
COPYING.LIB | ||
COPYING.RUNTIME | ||
COPYING3 | ||
COPYING3.LIB | ||
depcomp | ||
install-sh | ||
libtool-ldflags | ||
libtool.m4 | ||
ltgcc.m4 | ||
ltmain.sh | ||
ltoptions.m4 | ||
ltsugar.m4 | ||
ltversion.m4 | ||
lt~obsolete.m4 | ||
MAINTAINERS | ||
Makefile.def | ||
Makefile.in | ||
Makefile.tpl | ||
missing | ||
mkdep | ||
mkinstalldirs | ||
move-if-change | ||
multilib.am | ||
README | ||
symlink-tree | ||
test-driver | ||
ylwrap |
This directory contains the GNU Compiler Collection (GCC). The GNU Compiler Collection is free software. See the files whose names start with COPYING for copying permission. The manuals, and some of the runtime libraries, are under different terms; see the individual source files for details. The directory INSTALL contains copies of the installation information as HTML and plain text. The source of this information is gcc/doc/install.texi. The installation information includes details of what is included in the GCC sources and what files GCC installs. See the file gcc/doc/gcc.texi (together with other files that it includes) for usage and porting information. An online readable version of the manual is in the files gcc/doc/gcc.info*. See http://gcc.gnu.org/bugs/ for how to report bugs usefully. Copyright years on GCC source files may be listed using range notation, e.g., 1987-2012, indicating that every year in the range, inclusive, is a copyrightable year that could otherwise be listed individually.