[utils] replace gnu extension with template for c++.