[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Common gripe for unavailable functions when library does not exist
From: |
Rik |
Subject: |
Re: Common gripe for unavailable functions when library does not exist |
Date: |
Sat, 16 Jan 2016 14:38:18 -0800 |
On 01/15/2016 12:32 PM, Andreas Weber wrote:
> Am 15.01.2016 um 20:42 schrieb Rik:
>
>> Strategy 3) Declare macro that expands to error message and use that in
>> place of error or gripe.
>>
>> See audiodevinfo.cc which has
>>
>> #define NO_PORTAUDIO_MSG \
>> error ("portaudio not found on your system and thus audio functionality
>> is not present"); \
>> (void) args; /* silence compiler warning "unused parameter" */
> That was my change during code sprint. I tried to minimize the redundant
> code for better readability and silence the warnings. I'll change this
> as soon as we have a decision how to proceed, okay?
Andy,
I changed the function gripe_disabled_feature to
gripe_disabled_feature (const std::string& fcn, const std::string& feature,
const std::string& pkg /*="Octave"*/)
{
error ("%s: support for %s was unavailable or disabled when %s was built",
fcn.c_str (), feature.c_str (), pkg.c_str ());
}
This can now cover instances where either a library was unavailable or a
configure switch was used which prevents a function from being available.
We aren't going to bother with silencing all warnings so the pattern should
now be
#ifdef HAVE_XXX
...
#else
gripe_disabled_feature (...)
#endif
I think you can do a search and replace for NO_PORTAUDIO_MSG and replace it
with gripe_disabled_feature()
Thanks,
Rik