Update trek.h to add __unused and __printflike attributes

* Reapply following commit

    commit 1b12f0c0fe3803aa6638a285c64320839b293977
    Author: Kenji Rikitake <kenji.rikitake@acm.org>
    Date:   Sat May 3 09:48:15 2014 +0900

        Add __unused definition to trek.h

* Add __printflike directive for GCC
* See <https://mail-index.netbsd.org/tech-userlevel/2012/03/04/msg006197.html>
* Fix __GNUC_PREREQ__ -> __GNUC_PREREQ in trek.h