[all-commits] [llvm/llvm-project] 385e7d: Correctly diagnose prototype redeclaration errors ...

Aaron Ballman via All-commits all-commits at lists.llvm.org
Wed Apr 13 05:22:15 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 385e7df33046d7292612ee1e3ac00a59d8bc0441
      https://github.com/llvm/llvm-project/commit/385e7df33046d7292612ee1e3ac00a59d8bc0441
  Author: Aaron Ballman <aaron at aaronballman.com>
  Date:   2022-04-13 (Wed, 13 Apr 2022)

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

  Log Message:
  -----------
  Correctly diagnose prototype redeclaration errors in C

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.)




More information about the All-commits mailing list