comp.lang.ada
 help / color / mirror / Atom feed
From: Mark Wilson <markwilson@wilsonnet.technology>
Subject: Odd Behaviour
Date: Tue, 18 Jan 2022 03:05:53 -0800 (PST)	[thread overview]
Message-ID: <09dcb07d-f7b8-432b-8338-840ff90faef1n@googlegroups.com> (raw)

If I use,

   procedure SQLAllocHandle
     (Result          : out    SQLRETURN;
      HandleType      : in     SQL_HANDLE_TYPE;
      InputHandle     : in     SQLHANDLE;
      OutputHandlePtr : in out SQLHANDLE)
     with
       Import        => True,
       Convention    => C,
       External_Name => "SQLAllocHandle";
   pragma Import_Valued_Procedure (SQLAllocHandle);

then everything works as expected. However, if I add the following Pre and Post conditions (it's definitely not the Global or Depends)

   procedure SQLAllocHandle
     (Result          : out    SQLRETURN;
      HandleType      : in     SQL_HANDLE_TYPE;
      InputHandle     : in     SQLHANDLE;
      OutputHandlePtr : in out SQLHANDLE)
     with
       Import        => True,
       Convention    => C,
       External_Name => "SQLAllocHandle",
       Global        => null,
       Depends       => ((Result, OutputHandlePtr) =>
                           (HandleType, InputHandle, OutputHandlePtr)),
       Pre           => (if HandleType = SQL_HANDLE_ENV then
                            InputHandle = SQL_NULL_HANDLE
                         else
                            InputHandle /= SQL_NULL_HANDLE),
       Post          => (if SQL_OK (Result) then
                            OutputHandlePtr /= SQL_NULL_HANDLE
                         else
                            OutputHandlePtr = SQL_NULL_HANDLE);

   pragma Import_Valued_Procedure (SQLAllocHandle);

then an error is raised: 'warning: Valued_Procedure has no effect for convention Ada [enabled by default]' If I ignore the error, using

 pragma Warnings (Off, "*convention Ada*");

 then it doesn't work at all, as one would expect, raising storage_error.

So, is it the case that, even if you suppress all checks, using an 'if' in a pre or post condition forces a import function stub to only be convention Ada? 

             reply	other threads:[~2022-01-18 11:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-18 11:05 Mark Wilson [this message]
2022-01-18 11:16 ` Odd Behaviour Marius Amado-Alves
2022-01-18 11:21   ` Mark Wilson
2022-01-18 11:24     ` Mark Wilson
2022-01-18 11:28 ` Jeffrey R.Carter
2022-01-18 11:35   ` Mark Wilson
2022-01-18 11:48 ` Jeffrey R.Carter
2022-01-18 11:51   ` Mark Wilson
2022-01-18 12:08     ` Mark Wilson
2022-01-18 12:18       ` Mark Wilson
2022-01-18 12:27         ` Mark Wilson
2022-01-18 13:50           ` Mark Wilson
2022-01-18 12:25       ` Jeffrey R.Carter
2022-01-18 12:30         ` Mark Wilson
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox