Thats because fish doesn't do wordsplitting anything like how bash does. The `;` is still expected. This works:

~~~~c
if (data->type == AGENT_GPG_AGENT)
    printf("set -x GPG_AGENT_INFO '%s';\n", data->gpg);

printf("set -x SSH_AUTH_SOCK '%s';\n", data->sock);
printf("set -x SSH_AGENT_PID '%d';\n", data->pid);
~~~~