warn about default TRUE bool args
to stop anyone making one again, hopefully
This commit is contained in:
parent
0b050f4046
commit
aaf26765f2
@ -1787,6 +1787,19 @@ vips_object_class_install_argument( VipsObjectClass *object_class,
|
|||||||
g_type_name( G_TYPE_FROM_CLASS( ac->object_class ) ),
|
g_type_name( G_TYPE_FROM_CLASS( ac->object_class ) ),
|
||||||
g_param_spec_get_name( ((VipsArgument *) ac)->pspec ) );
|
g_param_spec_get_name( ((VipsArgument *) ac)->pspec ) );
|
||||||
|
|
||||||
|
/* Warn about optional boolean args which default TRUE. These won't
|
||||||
|
* work from the CLI, since simple GOption switches don't allow
|
||||||
|
* `=false`.
|
||||||
|
*/
|
||||||
|
if( !(flags & VIPS_ARGUMENT_REQUIRED) &&
|
||||||
|
!(flags & VIPS_ARGUMENT_DEPRECATED) &&
|
||||||
|
G_IS_PARAM_SPEC_BOOLEAN( pspec ) &&
|
||||||
|
G_PARAM_SPEC_BOOLEAN( pspec )->default_value )
|
||||||
|
g_warning( "vips_object_class_install_argument: "
|
||||||
|
"default TRUE BOOL arg %s.%s",
|
||||||
|
g_type_name( G_TYPE_FROM_CLASS( object_class ) ),
|
||||||
|
g_param_spec_get_name( pspec ) );
|
||||||
|
|
||||||
argument_table_traverse = g_slist_prepend(
|
argument_table_traverse = g_slist_prepend(
|
||||||
argument_table_traverse, argument_class );
|
argument_table_traverse, argument_class );
|
||||||
argument_table_traverse = g_slist_sort(
|
argument_table_traverse = g_slist_sort(
|
||||||
|
Loading…
Reference in New Issue
Block a user