This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Improve explanations for non-staticness


This patch improves the messages given to explain why expressions
are not static (when they are required to be). There are two changes.
First such messages are now continuations, which means they work
nicely with -gnatj. Second if a string literal comes from aggregates
that are never static, the message is now clearer. The following
is compiled with -gnatj65.

     1. package NonSOthers5 is
     2.    B  : constant String (1 .. 6) := (others => 'A');
     3.    DH : constant String (1 .. 8) := B & "BB";
     4.    X : Integer;
     5.    pragma Export (C, X, Link_Name => DH);
                                             |
        >>> argument for pragma "Export" must be a static
            expression, aggregate (at line 2) is never static

     6.    Y : Integer;
     7.    pragma Export (C, Y, Link_Name => B);
                                             |
        >>> argument for pragma "Export" must be a static
            expression, aggregate (at line 2) is never static

     8.    Z : Integer;
     9.    subtype S5 is String (1 .. 5);
    10.    pragma Export (C, Z, Link_Name => S5'(Others => 'Z'));
                                             |
        >>> argument for pragma "Export" must be a static
            expression, an aggregate is never static (RM 4.9)

    11. end;

Tested on x86_64-pc-linux-gnu, committed on trunk

2013-04-11  Robert Dewar  <dewar@adacore.com>

	* errout.ads: Minor reformatting.
	* sem_eval.adb (Why_Not_Static): Now issues continuation messages
	(Why_Not_Static): Test for aggregates behind string literals.
	* sem_eval.ads (Why_Not_Static): Now issues continuation messages.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]