I'd rather see..
#if defined (GPIO_PORT_xxx_BASE)  for each one, rather than making assumptions about families.

This has already happened on the L1 series, where new ports were added in later versions of the family