diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-01-23 09:30:37 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-01-23 09:30:37 +0100 |
commit | e1308fa85fd1a90f8d8da884531b6081d2a4d8a7 (patch) | |
tree | 7c32d49d1df71d989f2d62c9a87a67fc204c41ba /gcc/ada/adadecode.c | |
parent | daecebc805c2bd20e1bd5addc0d6f77577ac0363 (diff) | |
download | gcc-e1308fa85fd1a90f8d8da884531b6081d2a4d8a7.zip gcc-e1308fa85fd1a90f8d8da884531b6081d2a4d8a7.tar.gz gcc-e1308fa85fd1a90f8d8da884531b6081d2a4d8a7.tar.bz2 |
[multiple changes]
2012-01-23 Hristian Kirtchev <kirtchev@adacore.com>
* freeze.adb (Check_Current_Instance): Issue an
error when the prefix of 'Unchecked_Access or 'Access does not
denote a legal aliased view of a type.
(Freeze_Record_Type): Do not halt the processing of record components
once the Has_Controlled_Component is set as this bypasses the remaining
checks.
(Is_Aliased_View_Of_Type): New routine.
2012-01-23 Thomas Quinot <quinot@adacore.com>
* errout.ads, freeze.adb: Minor reformatting.
2012-01-23 Thomas Quinot <quinot@adacore.com>
* sem_ch10.adb, sem_prag.adb: Remove redundant apostrophes in error
messages.
2012-01-23 Olivier Hainque <hainque@adacore.com>
* adadecode.c (__gnat_decode): Deal with empty input early,
preventing potential erroneous memory access later on.
From-SVN: r183407
Diffstat (limited to 'gcc/ada/adadecode.c')
-rw-r--r-- | gcc/ada/adadecode.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/gcc/ada/adadecode.c b/gcc/ada/adadecode.c index 1c48856..2569481 100644 --- a/gcc/ada/adadecode.c +++ b/gcc/ada/adadecode.c @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 2001-2011, Free Software Foundation, Inc. * + * Copyright (C) 2001-2012, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -42,7 +42,7 @@ #include <stdio.h> #include <ctype.h> -#include "adaint.h" +#include "adaint.h" /* for a macro version of xstrdup. */ #ifndef ISDIGIT #define ISDIGIT(c) isdigit(c) @@ -162,8 +162,20 @@ __gnat_decode (const char *coded_name, char *ada_name, int verbose) int in_task = 0; int body_nested = 0; + /* Deal with empty input early. This allows assuming non-null length + later on, simplifying coding. In principle, it should be our callers + business not to call here for empty inputs. It is easy enough to + allow it, however, and might allow simplifications upstream so is not + a bad thing per se. We need a guard in any case. */ + + if (*coded_name == '\0') + { + *ada_name = '\0'; + return; + } + /* Check for library level subprogram. */ - if (has_prefix (coded_name, "_ada_")) + else if (has_prefix (coded_name, "_ada_")) { strcpy (ada_name, coded_name + 5); lib_subprog = 1; |