[PATCH] D123627: Correctly diagnose prototype redeclaration errors in C

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 12 13:32:27 PDT 2022


aaron.ballman created this revision.
aaron.ballman added reviewers: jyknight, eli.friedman, clang-language-wg.
Herald added a project: All.
aaron.ballman requested review of this revision.
Herald added a project: clang.

We did not implement C99 6.7.5.3p15 fully in that we missed the rule for compatible function types where a prior declaration has a prototype and a subsequent definition (not just declaration) has an empty identifier list or an identifier list with a mismatch in parameter arity. This addresses that situation by issuing an error on code like:

  void f(int);
  void f() {} // type conflicts with previous declaration

(Note: we already diagnose the other type conflict situations appropriately, this was the only situation we hadn't covered that I could find.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123627

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/test/CodeGen/functions.c
  clang/test/Sema/predefined-function.c
  clang/test/Sema/prototype-redecls.c
  clang/test/Sema/warn-deprecated-non-prototype.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123627.422320.patch
Type: text/x-patch
Size: 10590 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220412/53c16e92/attachment.bin>


More information about the cfe-commits mailing list