@@ -392,53 +392,59 @@ macro_rules! __attribute_helper {
392
392
393
393
}
394
394
395
- /// Create an `extern "C" fn(...) -> _` type .
395
+ /// Create function pointer type with inferred arguments .
396
396
///
397
397
/// TODO: Investigate if there's a better way of doing this.
398
398
#[ doc( hidden) ]
399
399
#[ macro_export]
400
- macro_rules! __extern_fn_ptr {
400
+ macro_rules! __fn_ptr {
401
401
{
402
+ @( $( $qualifiers: tt) * )
402
403
$( $param1: ident) ? $( _) ?: $param1_ty: ty,
403
404
$( $param2: ident) ? $( _) ?: $param2_ty: ty $( , ) ?
404
405
} => {
405
- extern "C" fn ( _, _) -> _
406
+ $ ( $qualifiers ) * fn ( _, _) -> _
406
407
} ;
407
408
{
409
+ @( $( $qualifiers: tt) * )
408
410
$( $param1: ident) ? $( _) ?: $param1_ty: ty,
409
411
$( $param2: ident) ? $( _) ?: $param2_ty: ty,
410
412
$( $param3: ident) ? $( _) ?: $param3_ty: ty $( , ) ?
411
413
} => {
412
- extern "C" fn ( _, _, _) -> _
414
+ $ ( $qualifiers ) * fn ( _, _, _) -> _
413
415
} ;
414
416
{
417
+ @( $( $qualifiers: tt) * )
415
418
$( $param1: ident) ? $( _) ?: $param1_ty: ty,
416
419
$( $param2: ident) ? $( _) ?: $param2_ty: ty,
417
420
$( $param3: ident) ? $( _) ?: $param3_ty: ty,
418
421
$( $param4: ident) ? $( _) ?: $param4_ty: ty $( , ) ?
419
422
} => {
420
- extern "C" fn ( _, _, _, _) -> _
423
+ $ ( $qualifiers ) * fn ( _, _, _, _) -> _
421
424
} ;
422
425
{
426
+ @( $( $qualifiers: tt) * )
423
427
$( $param1: ident) ? $( _) ?: $param1_ty: ty,
424
428
$( $param2: ident) ? $( _) ?: $param2_ty: ty,
425
429
$( $param3: ident) ? $( _) ?: $param3_ty: ty,
426
430
$( $param4: ident) ? $( _) ?: $param4_ty: ty,
427
431
$( $param5: ident) ? $( _) ?: $param5_ty: ty $( , ) ?
428
432
} => {
429
- extern "C" fn ( _, _, _, _, _) -> _
433
+ $ ( $qualifiers ) * fn ( _, _, _, _, _) -> _
430
434
} ;
431
435
{
436
+ @( $( $qualifiers: tt) * )
432
437
$( $param1: ident) ? $( _) ?: $param1_ty: ty,
433
438
$( $param2: ident) ? $( _) ?: $param2_ty: ty,
434
439
$( $param3: ident) ? $( _) ?: $param3_ty: ty,
435
440
$( $param4: ident) ? $( _) ?: $param4_ty: ty,
436
441
$( $param5: ident) ? $( _) ?: $param5_ty: ty,
437
442
$( $param6: ident) ? $( _) ?: $param6_ty: ty $( , ) ?
438
443
} => {
439
- extern "C" fn ( _, _, _, _, _, _) -> _
444
+ $ ( $qualifiers ) * fn ( _, _, _, _, _, _) -> _
440
445
} ;
441
446
{
447
+ @( $( $qualifiers: tt) * )
442
448
$( $param1: ident) ? $( _) ?: $param1_ty: ty,
443
449
$( $param2: ident) ? $( _) ?: $param2_ty: ty,
444
450
$( $param3: ident) ? $( _) ?: $param3_ty: ty,
@@ -447,9 +453,10 @@ macro_rules! __extern_fn_ptr {
447
453
$( $param6: ident) ? $( _) ?: $param6_ty: ty,
448
454
$( $param7: ident) ? $( _) ?: $param7_ty: ty $( , ) ?
449
455
} => {
450
- extern "C" fn ( _, _, _, _, _, _, _) -> _
456
+ $ ( $qualifiers ) * fn ( _, _, _, _, _, _, _) -> _
451
457
} ;
452
458
{
459
+ @( $( $qualifiers: tt) * )
453
460
$( $param1: ident) ? $( _) ?: $param1_ty: ty,
454
461
$( $param2: ident) ? $( _) ?: $param2_ty: ty,
455
462
$( $param3: ident) ? $( _) ?: $param3_ty: ty,
@@ -459,9 +466,10 @@ macro_rules! __extern_fn_ptr {
459
466
$( $param7: ident) ? $( _) ?: $param7_ty: ty,
460
467
$( $param8: ident) ? $( _) ?: $param8_ty: ty $( , ) ?
461
468
} => {
462
- extern "C" fn ( _, _, _, _, _, _, _, _) -> _
469
+ $ ( $qualifiers ) * fn ( _, _, _, _, _, _, _, _) -> _
463
470
} ;
464
471
{
472
+ @( $( $qualifiers: tt) * )
465
473
$( $param1: ident) ? $( _) ?: $param1_ty: ty,
466
474
$( $param2: ident) ? $( _) ?: $param2_ty: ty,
467
475
$( $param3: ident) ? $( _) ?: $param3_ty: ty,
@@ -472,9 +480,10 @@ macro_rules! __extern_fn_ptr {
472
480
$( $param8: ident) ? $( _) ?: $param8_ty: ty,
473
481
$( $param9: ident) ? $( _) ?: $param9_ty: ty $( , ) ?
474
482
} => {
475
- extern "C" fn ( _, _, _, _, _, _, _, _, _) -> _
483
+ $ ( $qualifiers ) * fn ( _, _, _, _, _, _, _, _, _) -> _
476
484
} ;
477
485
{
486
+ @( $( $qualifiers: tt) * )
478
487
$( $param1: ident) ? $( _) ?: $param1_ty: ty,
479
488
$( $param2: ident) ? $( _) ?: $param2_ty: ty,
480
489
$( $param3: ident) ? $( _) ?: $param3_ty: ty,
@@ -486,9 +495,10 @@ macro_rules! __extern_fn_ptr {
486
495
$( $param9: ident) ? $( _) ?: $param9_ty: ty,
487
496
$( $param10: ident) ? $( _) ?: $param10_ty: ty $( , ) ?
488
497
} => {
489
- extern "C" fn ( _, _, _, _, _, _, _, _, _, _) -> _
498
+ $ ( $qualifiers ) * fn ( _, _, _, _, _, _, _, _, _, _) -> _
490
499
} ;
491
500
{
501
+ @( $( $qualifiers: tt) * )
492
502
$( $param1: ident) ? $( _) ?: $param1_ty: ty,
493
503
$( $param2: ident) ? $( _) ?: $param2_ty: ty,
494
504
$( $param3: ident) ? $( _) ?: $param3_ty: ty,
@@ -501,9 +511,10 @@ macro_rules! __extern_fn_ptr {
501
511
$( $param10: ident) ? $( _) ?: $param10_ty: ty,
502
512
$( $param11: ident) ? $( _) ?: $param11_ty: ty $( , ) ?
503
513
} => {
504
- extern "C" fn ( _, _, _, _, _, _, _, _, _, _, _) -> _
514
+ $ ( $qualifiers ) * fn ( _, _, _, _, _, _, _, _, _, _, _) -> _
505
515
} ;
506
516
{
517
+ @( $( $qualifiers: tt) * )
507
518
$( $param1: ident) ? $( _) ?: $param1_ty: ty,
508
519
$( $param2: ident) ? $( _) ?: $param2_ty: ty,
509
520
$( $param3: ident) ? $( _) ?: $param3_ty: ty,
@@ -517,9 +528,10 @@ macro_rules! __extern_fn_ptr {
517
528
$( $param11: ident) ? $( _) ?: $param11_ty: ty,
518
529
$( $param12: ident) ? $( _) ?: $param12_ty: ty $( , ) ?
519
530
} => {
520
- extern "C" fn ( _, _, _, _, _, _, _, _, _, _, _, _) -> _
531
+ $ ( $qualifiers ) * fn ( _, _, _, _, _, _, _, _, _, _, _, _) -> _
521
532
} ;
522
533
{
534
+ @( $( $qualifiers: tt) * )
523
535
$( $param1: ident) ? $( _) ?: $param1_ty: ty,
524
536
$( $param2: ident) ? $( _) ?: $param2_ty: ty,
525
537
$( $param3: ident) ? $( _) ?: $param3_ty: ty,
@@ -534,9 +546,10 @@ macro_rules! __extern_fn_ptr {
534
546
$( $param12: ident) ? $( _) ?: $param12_ty: ty,
535
547
$( $param13: ident) ? $( _) ?: $param13_ty: ty $( , ) ?
536
548
} => {
537
- extern "C" fn ( _, _, _, _, _, _, _, _, _, _, _, _, _) -> _
549
+ $ ( $qualifiers ) * fn ( _, _, _, _, _, _, _, _, _, _, _, _, _) -> _
538
550
} ;
539
551
{
552
+ @( $( $qualifiers: tt) * )
540
553
$( $param1: ident) ? $( _) ?: $param1_ty: ty,
541
554
$( $param2: ident) ? $( _) ?: $param2_ty: ty,
542
555
$( $param3: ident) ? $( _) ?: $param3_ty: ty,
@@ -552,6 +565,6 @@ macro_rules! __extern_fn_ptr {
552
565
$( $param13: ident) ? $( _) ?: $param13_ty: ty,
553
566
$( $param14: ident) ? $( _) ?: $param14_ty: ty $( , ) ?
554
567
} => {
555
- extern "C" fn ( _, _, _, _, _, _, _, _, _, _, _, _, _, _) -> _
568
+ $ ( $qualifiers ) * fn ( _, _, _, _, _, _, _, _, _, _, _, _, _, _) -> _
556
569
} ;
557
570
}
0 commit comments