Skip to content

Commit

Permalink
Improve the find_unused_types.sh script, remove some more unused types.
Browse files Browse the repository at this point in the history
  • Loading branch information
poletti-marco committed Jul 27, 2014
1 parent 8a98432 commit 7193876
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 41 deletions.
18 changes: 17 additions & 1 deletion find_unused_types.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,23 @@

# This script greps the source code trying to find unused types.

for I in $(egrep -R '^ *(class|struct) ' include/ src/ | sed -e 's/.*class \([a-zA-Z0-9_]*\).*/\1/;s/.*struct \([a-zA-Z0-9_]*\).*/\1/' | sort | uniq)
TYPES=($(egrep -R '^( *class| *struct|using) ' include/ src/ | sed -e 's/.*\(class\|struct\|using\) \([a-zA-Z0-9_]*\).*/\2/' | sort | uniq))

echo Candidates:
for I in ${TYPES[@]}
do
N=$(fgrep -Rl "$I" include/ src/ | wc -l)
if [ $N == 1 ]
then
echo "$I"
grep -R "$I" include/ src/
echo
fi
done


echo Strong candidates:
for I in ${TYPES[@]}
do
N=$(fgrep -R "$I" include/ src/ | egrep -v '.*: *(class|struct) '"$I" | wc -l)
if [ $N == 0 ]
Expand Down
11 changes: 0 additions & 11 deletions include/fruit/impl/component.utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,6 @@ struct GetInjectAnnotation {
using Args = typename std::enable_if<ok, A>::type;
};

template <typename Dep>
struct DepRequirementsImpl {
};

template <typename Dep>
using DepRequirements = typename DepRequirementsImpl<Dep>::type;

template <typename C, typename Dep>
using RemoveRequirementFromDep = ConstructSignature<SignatureType<Dep>, remove_from_list<C, SignatureArgs<Dep>>>;

Expand All @@ -239,10 +232,6 @@ using ConstructDep = ConstructSignature<P*, list_to_set<AddPointerToList<Rs>>>;
template <typename Rs, typename... P>
using ConstructDeps = List<ConstructDep<P, Rs>...>;

// In Dep, replaces all requirements for R with the types in Rs
template <typename Dep, typename R, typename Rs>
using ReplaceRequirementsInDep = SignatureType<Dep>(replace_with_set<R, Rs, SignatureArgs<Dep>>);

template <typename Dep>
struct HasSelfLoop : is_in_list<SignatureType<Dep>, SignatureArgs<Dep>> {
};
Expand Down
29 changes: 0 additions & 29 deletions include/fruit/impl/metaprogramming.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,6 @@ struct is_in_list {}; // Not used
template <typename T, typename... Ts>
struct is_in_list<T, List<Ts...>> : static_or<std::is_same<T, Ts>::value...> {};

// ****************************
// Implementation of list_count

template <typename T, typename L>
struct list_count {}; // Not used

template <typename T, typename... Ts>
struct list_count<T, List<Ts...>> : static_sum<std::is_same<T, Ts>::value...> {};

// ****************************
// Implementation of is_empty_list

Expand Down Expand Up @@ -165,15 +156,6 @@ struct add_to_set_impl<true, T, L> {
template <typename T, typename L>
using add_to_set = typename add_to_set_impl<is_in_list<T, L>::value, T, L>::type;

// ***********************************
// Implementation of are_sets_disjoint

template <typename L1, typename L2>
struct are_sets_disjoint {}; // Not used

template <typename... Ts, typename... Us>
struct are_sets_disjoint<List<Ts...>, List<Us...>> : static_and<is_in_list<Ts, List<Us...>>::value...> {};

// ***********************************
// Implementation of set_intersection

Expand Down Expand Up @@ -324,17 +306,6 @@ struct list_size<List<Types...>> {
static constexpr int value = sizeof...(Types);
};

template <template<typename T> class Op, typename L>
struct LiftHelper {};

template <template<typename T> class Op, typename... Ts>
struct LiftHelper<Op, List<Ts...>> {
using type = List<Op<Ts>...>;
};

template <template<typename T> class Op, typename L>
using Lift = typename LiftHelper<Op, L>::type;

template <typename L>
struct AddPointerToListHelper {};

Expand Down

0 comments on commit 7193876

Please sign in to comment.