Skip to content

Tests for checking type requirements for bounds declarations.#48

Merged
dtarditi merged 4 commits intocheckedc:masterfrom
dtarditi:clang-issue41
Aug 31, 2016
Merged

Tests for checking type requirements for bounds declarations.#48
dtarditi merged 4 commits intocheckedc:masterfrom
dtarditi:clang-issue41

Conversation

@dtarditi
Copy link
Member

There is a pull request for the checked-clang repo (checkedc/checkedc-clang#42) that adds checking of type requirements for bounds declarations to clang. See the pull request for details.

This commit adds the matching tests. It includes both positive tests (that are supposed to work) and negative tests that should fail with an error message. We have added the expected error message from the clang implementation for the negative tests, so that the tests can be used in the clang test infrastructure. This commit also fixes issues in existing tests that the checking uncovered.

commit c027760a1b6aae03ee5a004b84940ebf88a78238
Author: David Tarditi <dtarditi@microsoft.com>
Date:   Mon Aug 29 17:35:42 2016 -0700

    Test typechecking bounds declarations for locals, globals, and members.

commit f284a76d6e7cc16e7108cf780da0734aac1733b5
Author: David Tarditi <dtarditi@microsoft.com>
Date:   Sat Aug 27 13:41:46 2016 -0700

    Fix typos uncovered by typechecking bounds declarations.

commit 599a8d273bc457ee861c28e7b6b9836725b84424
Merge: 97fa48f 930c9c2
Author: David Tarditi <dtarditi@microsoft.com>
Date:   Sat Aug 27 13:15:42 2016 -0700

    Merge branch 'master' of https://github.com/Microsoft/checkedc

commit 97fa48fc173d10604b66707966a8209c2e783768
Author: David Tarditi <dtarditi@microsoft.com>
Date:   Thu Aug 25 10:57:03 2016 -0700

    Update typechecking wording for count and byte_count.
- Add comment describing the organization of tests.
- Add some missing cases for local variables, global variables,
and member bounds declarations.
- Add tests for return bounds declarations.
- Make the tests structurally equivalent for bounds declarations
checks.  Use different prefixes for names to disambiguate them,
but use the same numbering scheme for all the different cases.
- Change a 'must' to 'can' because there are additional types of
variables that can have bounds declarations.  These are described
later in the document.
- Loosen the requirements for bounds(e1, e2): allow e1 and e2 to be
  pointers to the same type of object.
to be different is useful for describing the results of pointer casts and
\var{e2} must be pointers to the same type. Typically \var{x} is also
a pointer to that type or an array of that type.
However, \var{x} can point to or be an array of a different type.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe \var{x} can be a pointer to or an array of?

@reubeno
Copy link

reubeno commented Aug 31, 2016

Looks reasonable to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants