Anastasia added a comment.


> It looks like there's already some type analysis in 
> `DiagnoseAssignmentResult` to get a specialized diagnostic for certain cases 
> of function-pointer assignment.  That could probably be easily moved into 
> `CheckAssignmentConstraints` by just adding a few more cases to 
> `AssignConvertResult`.

One interesting effect I get after modifying this that some extra tests in C 
mode started to report function pointer instead of generic pointer warning. I 
feel this is because in `checkPointerTypesForAssignment`  we use canonical 
types and in `DiagnoseAssignmentResult` we don't.

Perhaps this way is better? I can update the test if so and then finalize some 
other bits.

  FAIL: Clang :: Sema/block-return.c (9341 of 16808)
  ******************** TEST 'Clang :: Sema/block-return.c' FAILED 
********************
  Script:
  --
  : 'RUN: at line 1';   <...>build/bin/clang -cc1 -internal-isystem 
<...>build/lib/clang/11.0.0/include -nostdsysteminc -Wno-int-to-pointer-cast 
-pedantic -fsyntax-only <...>clang/test/Sema/block-return.c -verify -fblocks
  --
  Exit Code: 1
  
  Command Output (stderr):
  --
  error: 'warning' diagnostics expected but not seen: 
    File <...>clang/test/Sema/block-return.c Line 82: incompatible pointer 
types initializing 'int (*)(const char *)' with an expression of type 'int 
(char *)'
  error: 'warning' diagnostics seen but not expected: 
    File <...>clang/test/Sema/block-return.c Line 82: incompatible function 
pointer types initializing 'int (*)(const char *)' with an expression of type 
'int (char *)'
  2 errors generated.
  
  --
  
  ********************
  FAIL: Clang :: Sema/callingconv-ms_abi.c (9396 of 16808)
  ******************** TEST 'Clang :: Sema/callingconv-ms_abi.c' FAILED 
********************
  Script:
  --
  : 'RUN: at line 1';   <...>build/bin/clang -cc1 -internal-isystem 
<...>build/lib/clang/11.0.0/include -nostdsysteminc -fsyntax-only -verify 
-triple x86_64-pc-win32 <...>clang/test/Sema/callingconv-ms_abi.c
  --
  Exit Code: 1
  
  Command Output (stderr):
  --
  error: 'warning' diagnostics expected but not seen: 
    File <...>clang/test/Sema/callingconv-ms_abi.c Line 7: incompatible pointer 
types
    File <...>clang/test/Sema/callingconv-ms_abi.c Line 9: incompatible pointer 
types
  error: 'warning' diagnostics seen but not expected: 
    File <...>clang/test/Sema/callingconv-ms_abi.c Line 7: incompatible 
function pointer types initializing 'void (*)(void)' with an expression of type 
'void (void) __attribute__((sysv_abi))'
    File <...>clang/test/Sema/callingconv-ms_abi.c Line 9: incompatible 
function pointer types initializing 'void (*)(void) __attribute__((sysv_abi))' 
with an expression of type 'void (void) __attribute__((ms_abi))'
  4 errors generated.
  
  --
  
  ********************
  FAIL: Clang :: Sema/callingconv-sysv_abi.c (9397 of 16808)
  ******************** TEST 'Clang :: Sema/callingconv-sysv_abi.c' FAILED 
********************
  Script:
  --
  : 'RUN: at line 1';   <...>build/bin/clang -cc1 -internal-isystem 
<...>build/lib/clang/11.0.0/include -nostdsysteminc -fsyntax-only -verify 
-triple x86_64-pc-linux-gnu <...>clang/test/Sema/callingconv-sysv_abi.c
  --
  Exit Code: 1
  
  Command Output (stderr):
  --
  error: 'warning' diagnostics expected but not seen: 
    File <...>clang/test/Sema/callingconv-sysv_abi.c Line 4: incompatible 
pointer types
    File <...>clang/test/Sema/callingconv-sysv_abi.c Line 9: incompatible 
pointer types
  error: 'warning' diagnostics seen but not expected: 
    File <...>clang/test/Sema/callingconv-sysv_abi.c Line 4: incompatible 
function pointer types initializing 'void (*)(void)' with an expression of type 
'void (void) __attribute__((ms_abi))'
    File <...>clang/test/Sema/callingconv-sysv_abi.c Line 9: incompatible 
function pointer types initializing 'void (*)(void) __attribute__((ms_abi))' 
with an expression of type 'void (void) __attribute__((sysv_abi))'
  4 errors generated.
  
  --
  
  ********************
  FAIL: Clang :: Sema/callingconv.c (9398 of 16808)
  ******************** TEST 'Clang :: Sema/callingconv.c' FAILED 
********************
  Script:
  --
  : 'RUN: at line 1';   <...>build/bin/clang -cc1 -internal-isystem 
<...>build/lib/clang/11.0.0/include -nostdsysteminc 
<...>clang/test/Sema/callingconv.c -fsyntax-only -triple i386-unknown-unknown 
-verify
  : 'RUN: at line 2';   <...>build/bin/clang -cc1 -internal-isystem 
<...>build/lib/clang/11.0.0/include -nostdsysteminc 
<...>clang/test/Sema/callingconv.c -fsyntax-only -triple i386-unknown-unknown 
-fms-compatibility -DWIN -verify
  --
  Exit Code: 1
  
  Command Output (stderr):
  --
  error: 'warning' diagnostics expected but not seen: 
    File <...>clang/test/Sema/callingconv.c Line 34: incompatible pointer types
  error: 'warning' diagnostics seen but not expected: 
    File <...>clang/test/Sema/callingconv.c Line 34: incompatible function 
pointer types initializing 'void (*)(void) __attribute__((cdecl))' with an 
expression of type 'void (void) __attribute__((fastcall))'
  2 errors generated.
  
  --
  
  ********************
  FAIL: Clang :: Sema/pass-object-size.c (9608 of 16808)
  ******************** TEST 'Clang :: Sema/pass-object-size.c' FAILED 
********************
  Script:
  --
  : 'RUN: at line 1';   <...>build/bin/clang -cc1 -internal-isystem 
<...>build/lib/clang/11.0.0/include -nostdsysteminc -fsyntax-only -verify 
<...>clang/test/Sema/pass-object-size.c -triple x86_64-linux-gnu 
-Wincompatible-pointer-types
  --
  Exit Code: 1
  
  Command Output (stderr):
  --
  error: 'warning' diagnostics expected but not seen: 
    File <...>clang/test/Sema/pass-object-size.c Line 47: incompatible pointer 
types initializing 'void (*)(void *)' with an expression of type '<overloaded 
function type>'
    File <...>clang/test/Sema/pass-object-size.c Line 48: incompatible pointer 
types initializing 'void (*)(void *)' with an expression of type '<overloaded 
function type>'
  error: 'warning' diagnostics seen but not expected: 
    File <...>clang/test/Sema/pass-object-size.c Line 47: incompatible function 
pointer types initializing 'void (*)(void *)' with an expression of type 
'<overloaded function type>'
    File <...>clang/test/Sema/pass-object-size.c Line 48: incompatible function 
pointer types initializing 'void (*)(void *)' with an expression of type 
'<overloaded function type>'
  4 errors generated.
  
  --
  
  ********************
  FAIL: Clang :: Sema/overloadable.c (9609 of 16808)
  ******************** TEST 'Clang :: Sema/overloadable.c' FAILED 
********************
  Script:
  --
  : 'RUN: at line 1';   <...>build/bin/clang -cc1 -internal-isystem 
<...>build/lib/clang/11.0.0/include -nostdsysteminc -fsyntax-only -verify 
<...>clang/test/Sema/overloadable.c -Wincompatible-pointer-types
  --
  Exit Code: 1
  
  Command Output (stderr):
  --
  error: 'error' diagnostics expected but not seen: 
    File <...>clang/test/Sema/overloadable.c Line 29: call to 'accept_funcptr' 
is ambiguous
  error: 'error' diagnostics seen but not expected: 
    File <...>clang/test/Sema/overloadable.c Line 29: no matching function for 
call to 'accept_funcptr'
  error: 'warning' diagnostics expected but not seen: 
    File <...>clang/test/Sema/overloadable.c Line 122: incompatible pointer 
types initializing 'void (*)(void *)' with an expression of type '<overloaded 
function type>'
    File <...>clang/test/Sema/overloadable.c Line 123: incompatible pointer 
types initializing 'void (*)(int *)' with an expression of type '<overloaded 
function type>'
  error: 'warning' diagnostics seen but not expected: 
    File <...>clang/test/Sema/overloadable.c Line 122: incompatible function 
pointer types initializing 'void (*)(void *)' with an expression of type 
'<overloaded function type>'
    File <...>clang/test/Sema/overloadable.c Line 123: incompatible function 
pointer types initializing 'void (*)(int *)' with an expression of type 
'<overloaded function type>'
  6 errors generated.
  
  --
  
  ********************
  FAIL: Clang :: Sema/preserve-call-conv.c (9653 of 16808)
  ******************** TEST 'Clang :: Sema/preserve-call-conv.c' FAILED 
********************
  Script:
  --
  : 'RUN: at line 1';   <...>build/bin/clang -cc1 -internal-isystem 
<...>build/lib/clang/11.0.0/include -nostdsysteminc 
<...>clang/test/Sema/preserve-call-conv.c -fsyntax-only -triple 
x86_64-unknown-unknown -verify
  : 'RUN: at line 2';   <...>build/bin/clang -cc1 -internal-isystem 
<...>build/lib/clang/11.0.0/include -nostdsysteminc 
<...>clang/test/Sema/preserve-call-conv.c -fsyntax-only -triple 
arm64-unknown-unknown -verify
  : 'RUN: at line 3';   <...>build/bin/clang -cc1 -internal-isystem 
<...>build/lib/clang/11.0.0/include -nostdsysteminc 
<...>clang/test/Sema/preserve-call-conv.c -fsyntax-only -triple 
x86_64-unknown-windows-msvc -verify
  : 'RUN: at line 4';   <...>build/bin/clang -cc1 -internal-isystem 
<...>build/lib/clang/11.0.0/include -nostdsysteminc 
<...>clang/test/Sema/preserve-call-conv.c -fsyntax-only -triple 
aarch64-unknown-windows-msvc -verify
  : 'RUN: at line 5';   <...>build/bin/clang -cc1 -internal-isystem 
<...>build/lib/clang/11.0.0/include -nostdsysteminc 
<...>clang/test/Sema/preserve-call-conv.c -fsyntax-only -triple 
thumbv7-unknown-windows-msvc -verify
  --
  Exit Code: 1
  
  Command Output (stderr):
  --
  error: 'warning' diagnostics expected but not seen: 
    File <...>clang/test/Sema/preserve-call-conv.c Line 17: incompatible 
pointer types initializing 'void (*)(void *) __attribute__((cdecl))' with an 
expression of type 'void (void *) __attribute__((preserve_most))'
    File <...>clang/test/Sema/preserve-call-conv.c Line 18: incompatible 
pointer types initializing 'void (*)(void *)' with an expression of type 'void 
(void *) __attribute__((preserve_most))'
    File <...>clang/test/Sema/preserve-call-conv.c Line 33: incompatible 
pointer types initializing 'void (*)(void *) __attribute__((cdecl))' with an 
expression of type 'void (void *) __attribute__((preserve_all))'
    File <...>clang/test/Sema/preserve-call-conv.c Line 34: incompatible 
pointer types initializing 'void (*)(void *)' with an expression of type 'void 
(void *) __attribute__((preserve_all))'
  error: 'warning' diagnostics seen but not expected: 
    File <...>clang/test/Sema/preserve-call-conv.c Line 17: incompatible 
function pointer types initializing 'void (*)(void *) __attribute__((cdecl))' 
with an expression of type 'void (void *) __attribute__((preserve_most))'
    File <...>clang/test/Sema/preserve-call-conv.c Line 18: incompatible 
function pointer types initializing 'void (*)(void *)' with an expression of 
type 'void (void *) __attribute__((preserve_most))'
    File <...>clang/test/Sema/preserve-call-conv.c Line 33: incompatible 
function pointer types initializing 'void (*)(void *) __attribute__((cdecl))' 
with an expression of type 'void (void *) __attribute__((preserve_all))'
    File <...>clang/test/Sema/preserve-call-conv.c Line 34: incompatible 
function pointer types initializing 'void (*)(void *)' with an expression of 
type 'void (void *) __attribute__((preserve_all))'
  8 errors generated.
  
  --
  
  ********************
  FAIL: Clang :: SemaObjC/comptypes-legal.m (10887 of 16808)
  ******************** TEST 'Clang :: SemaObjC/comptypes-legal.m' FAILED 
********************
  Script:
  --
  : 'RUN: at line 1';   <...>build/bin/clang -cc1 -internal-isystem 
<...>build/lib/clang/11.0.0/include -nostdsysteminc -fsyntax-only -verify 
-pedantic <...>clang/test/SemaObjC/comptypes-legal.m
  --
  Exit Code: 1
  
  Command Output (stderr):
  --
  error: 'warning' diagnostics expected but not seen: 
    File <...>clang/test/SemaObjC/comptypes-legal.m Line 36: incompatible 
pointer types sending 'NSObject *(NSObject *, NSObject *)' to parameter of type 
'FuncSignature *'
  error: 'warning' diagnostics seen but not expected: 
    File <...>clang/test/SemaObjC/comptypes-legal.m Line 36: incompatible 
function pointer types sending 'NSObject *(NSObject *, NSObject *)' to 
parameter of type 'FuncSignature *' (aka 'id (*)(NSObject *, Derived *)')
  2 errors generated.
  
  --
  
  ********************
  
  Testing Time: 438.97s
  ********************
  Failing Tests (8):
      Clang :: Sema/block-return.c
      Clang :: Sema/callingconv-ms_abi.c
      Clang :: Sema/callingconv-sysv_abi.c
      Clang :: Sema/callingconv.c
      Clang :: Sema/overloadable.c
      Clang :: Sema/pass-object-size.c
      Clang :: Sema/preserve-call-conv.c
      Clang :: SemaObjC/comptypes-legal.m




CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74116/new/

https://reviews.llvm.org/D74116



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to