If a cop sees you warning other drivers then they might decide to stop you and either warn you or give you a ticket.
It depends on the location your at and whether the cop has an attitude. I really don't think it's illegal though. But the cop might find something else to ticket you for depending on what mood the cop is in that day.